wok annotate glpi/receipt @ rev 25403

updated vzctl (3.0.25.1 -> 4.11.1)
author Hans-G?nter Theisgen
date Tue Aug 02 16:35:24 2022 +0100 (2022-08-02)
parents 376c63dc731b
children 20ad21d5532c
rev   line source
erjo@2714 1 # SliTaz package receipt.
erjo@2714 2
erjo@2714 3 PACKAGE="glpi"
pascal@23837 4 VERSION="9.4.6"
erjo@2714 5 CATEGORY="network"
erjo@2714 6 SHORT_DESC="IT and Asset Management."
erjo@2714 7 MAINTAINER="erjo@slitaz.org"
pascal@15589 8 LICENSE="GPL2"
Hans-G?nter@20976 9 WEB_SITE="https://glpi-project.org/"
Hans-G?nter@20976 10
Hans-G?nter@20976 11 TARBALL="$PACKAGE-$VERSION.tgz"
Hans-G?nter@20976 12 WGET_URL="https://github.com/glpi-project/$PACKAGE/releases/download/$VERSION/$TARBALL"
erjo@2714 13
Hans-G?nter@22855 14 DEPENDS="apache logrotate mysql pam php-apache php-imap php-ldap php-mysql"
Hans-G?nter@20976 15 BUILD_DEPENDS=""
Hans-G?nter@20976 16 CONFIG_FILES="/etc/glpi/config_db.php"
pascal@15589 17
pascal@24055 18 current_version()
pascal@24055 19 {
pascal@24055 20 wget -O - ${WGET_URL%/down*} 2>/dev/null | \
pascal@24055 21 sed '/archive.*tar/!d;s|.*/\(.*\).tar.*|\1|;q'
pascal@24055 22 }
pascal@24055 23
erjo@2714 24 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@2714 25 genpkg_rules()
erjo@2714 26 {
Hans-G?nter@22855 27 mkdir -p $fs/usr/share/$PACKAGE
Hans-G?nter@22855 28 mkdir -p $fs/etc/$PACKAGE
Hans-G?nter@22855 29 mkdir -p $fs/var/log/$PACKAGE
Hans-G?nter@22855 30 mkdir -p $fs/var/lib/$PACKAGE
erjo@2714 31
Hans-G?nter@22855 32 cp -a $src/* $fs/usr/share/$PACKAGE
Hans-G?nter@22855 33 [ -d $fs/usr/share/$PACKAGE/files ] &&
Hans-G?nter@22855 34 mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
Hans-G?nter@22855 35
Hans-G?nter@22855 36 # Copy configuration db as temporary file.
Hans-G?nter@22855 37 cp $stuff/config_db.php $fs/etc/glpi/
Hans-G?nter@22855 38 cp -a $stuff/logrotate.d $fs/etc
Hans-G?nter@22855 39
erjo@2714 40 cd $fs/usr/share/glpi
erjo@8353 41 [ -f config/config_db.php ] && rm -f config/config_db.php
erjo@8353 42 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
erjo@8353 43 ln -s /etc/glpi/config_db.php config/
Hans-G?nter@22855 44 [ -f $fs/etc/glpi/config_db_slave.php ] &&
Hans-G?nter@22855 45 ln -s /etc/glpi/config_db_slave.php config/
erjo@8353 46 ln -s /var/lib/glpi/files
erjo@2714 47 cd -
Hans-G?nter@22855 48 chown -R www.www $fs/var/lib/$PACKAGE/files \
Hans-G?nter@22855 49 $fs/etc/$PACKAGE/*
erjo@8353 50
erjo@8353 51 # Create the magic file config_path.php
erjo@8353 52 cat <<EOF> $fs/usr/share/glpi/config/config_path.php
erjo@8353 53 <?php
erjo@8353 54 // for packaging defaults
erjo@8353 55
erjo@8353 56 define("GLPI_CONFIG_DIR", "/etc/glpi");
erjo@8353 57
erjo@8353 58 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
erjo@8353 59 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
erjo@8353 60 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
erjo@8353 61 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
erjo@8353 62 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
erjo@8353 63 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
erjo@8353 64 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
erjo@8353 65
erjo@8353 66 define("GLPI_LOG_DIR", "/var/log/glpi");
erjo@8353 67 ?>
erjo@8353 68
erjo@8353 69 EOF
pascal@2715 70 }
pascal@2715 71
pascal@2715 72 post_install()
pascal@2715 73 {
erjo@2714 74 # Configure apache server
Hans-G?nter@22855 75 if [ -f "$1/etc/apache/httpd.conf" ]
Hans-G?nter@22855 76 then
Hans-G?nter@22855 77 if [ ! -f "$1/etc/apache/conf.d/glpi" ]
Hans-G?nter@22855 78 then
pascal@18730 79 cat > "$1/etc/apache/conf.d/glpi" <<EOT
erjo@2714 80 <IfModule mod_alias.c>
erjo@2714 81 Alias /glpi /usr/share/glpi/
erjo@2714 82 </IfModule>
erjo@2714 83 <Directory "/usr/share/glpi">
erjo@2714 84 Options Indexes FollowSymLinks
erjo@8353 85
erjo@8353 86 php_value memory_limit 64M
erjo@8353 87
erjo@2714 88 AllowOverride None
erjo@2714 89 Order deny,allow
erjo@2714 90 Allow from all
erjo@2714 91 </Directory>
erjo@2714 92
erjo@8353 93 <Directory /usr/share/glpi/config>
erjo@8353 94 Order Allow,Deny
erjo@8353 95 Deny from all
erjo@8353 96 </Directory>
erjo@8353 97
erjo@8353 98 <Directory /usr/share/glpi/locales>
erjo@8353 99 Order Allow,Deny
erjo@8353 100 Deny from all
erjo@8353 101 </Directory>
erjo@8353 102
erjo@8353 103 <Directory /usr/share/glpi/install/mysql>
erjo@8353 104 Order Allow,Deny
erjo@8353 105 Deny from all
erjo@8353 106 </Directory>
erjo@8353 107
erjo@8353 108 <Directory /usr/share/glpi/scripts>
erjo@8353 109 Order Allow,Deny
erjo@8353 110 Deny from all
erjo@8353 111 </Directory>
erjo@8353 112
erjo@8353 113
erjo@2714 114 EOT
Hans-G?nter@22855 115 if [ -z "$1" ]
Hans-G?nter@22855 116 then
erjo@2714 117 # Start Web server.
erjo@2714 118 test -f /var/run/apache/httpd.pid && \
Hans-G?nter@22855 119 ( kill -0 $(cat /var/run/apache/httpd.pid) && \
Hans-G?nter@22855 120 /etc/init.d/apache restart )
erjo@2714 121 fi
erjo@2714 122 fi
erjo@2714 123 fi
erjo@2714 124
erjo@2714 125 # Configure every thing for glpi.
Hans-G?nter@22855 126 if [ -z "$1" ]
Hans-G?nter@22855 127 then
Hans-G?nter@22855 128 if ( ! mysqladmin -s ping > /dev/null )
Hans-G?nter@22855 129 then
erjo@2714 130 echo "Starting MySQL server"
erjo@2714 131 ( /etc/init.d/mysql start ; status ) || exit
erjo@2714 132 sleep 4 #let the mysql daemon start
erjo@2714 133 fi
Hans-G?nter@22855 134 if ( ! mysql -u root -Be 'show databases' | grep -q glpi )
Hans-G?nter@22855 135 then
erjo@2714 136 echo -n "Create Glpi database"
erjo@2714 137 mysql -Be "create database glpi" ; status
erjo@2714 138 # We suppose that glpi user does not exist.
erjo@2714 139 # It may be false.
erjo@2714 140 echo -n "Create user glpi with password glpi"
erjo@2714 141 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
erjo@2714 142 identified by 'glpi'" ; status
erjo@2714 143 # At last create the database for glpi.
erjo@2714 144 echo -n "Create glpi database schema."
Hans-G?nter@20976 145 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-9.4-empty.sql ; status
erjo@2714 146
erjo@2714 147 fi
erjo@2714 148
erjo@2714 149 fi
pascal@18707 150 true
erjo@2714 151 }
erjo@2714 152
erjo@2714 153 post_remove()
erjo@2714 154 {
erjo@2714 155 echo -n "Would you like to remove data and database files.(y/n) "
erjo@2714 156 read answer
erjo@2714 157
erjo@2714 158 case $answer in
erjo@2714 159 y|Y)
erjo@2714 160 echo -n "Removing data directories..."
erjo@2714 161 rm -rf /var/lib/glpi ; status
Hans-G?nter@22855 162 if ( mysql -u root -Be 'show databases' | grep -q glpi )
Hans-G?nter@22855 163 then
erjo@2714 164 echo -n "Deleting Glpi database"
erjo@2714 165 mysql -Be "drop database glpi" ; status
erjo@2714 166 # We suppose that glpi user does not exist.
erjo@2714 167 # It may be false.
erjo@2714 168 echo -n "Delete user glpi"
erjo@3672 169 mysql -Be "delete from mysql.db where user='glpi'" ; status
erjo@2714 170 fi
erjo@2714 171 unset $answer
erjo@2714 172 ;;
erjo@2714 173 *)
erjo@2714 174 ;;
erjo@2714 175 esac
erjo@2714 176 }