wok-next annotate ocsinventory/receipt @ rev 21098
poppler: provide lib$PACKAGE for libs like some other packages do
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Jan 01 15:48:26 2019 +0200 (2019-01-01) |
parents | d5aab818505e |
children |
rev | line source |
---|---|
pascal@20179 | 1 # SliTaz package receipt v2. |
erjo@3673 | 2 |
erjo@3673 | 3 PACKAGE="ocsinventory" |
pascal@20181 | 4 VERSION="2.3.1" |
erjo@3673 | 5 CATEGORY="meta" |
al@21020 | 6 SHORT_DESC="Automated inventory and deployement system" |
erjo@3673 | 7 MAINTAINER="pascal.bellard@slitaz.org" |
pascal@15590 | 8 LICENSE="GPL2" |
al@21020 | 9 WEB_SITE="https://www.ocsinventory-ng.org/en/" |
al@21020 | 10 |
erjo@3673 | 11 SOURCE="OCSNG_UNIX_SERVER" |
erjo@3673 | 12 TARBALL="$SOURCE-$VERSION.tar.gz" |
pascal@20181 | 13 WGET_URL="https://github.com/OCSInventory-NG/OCSInventory-Server/archive/$VERSION.tar.gz" |
pascal@15590 | 14 |
pascal@20181 | 15 BUILD_DEPENDS="perl perl-dbd-mysql perl-apache-dbi perl-net-ip perl-xml-simple \ |
pascal@20181 | 16 wget" |
al@21020 | 17 SPLIT="$PACKAGE-server" # ocsreports |
erjo@3673 | 18 |
al@21020 | 19 compile_rules() { |
erjo@3673 | 20 cd $src/Apache |
erjo@3673 | 21 perl Makefile.PL && |
erjo@3673 | 22 make && |
al@21020 | 23 make DESTDIR=$install install |
erjo@3673 | 24 } |
erjo@3673 | 25 |
al@21020 | 26 genpkg_rules() { |
pascal@20179 | 27 case $PACKAGE in |
al@21020 | 28 ocsinventory) |
al@21020 | 29 DEPENDS="ocsinventory-server ocsinventory-agent ocsreports" |
al@21020 | 30 mkdir $fs/usr |
al@21020 | 31 TAGS="system administration" |
al@21020 | 32 ;; |
al@21020 | 33 *-server) |
al@21020 | 34 CAT="network|Iventory and package deployment system" |
al@21020 | 35 DEPENDS="apache php-apache mysql perl perl-xml-simple \ |
pascal@20179 | 36 perl-compress-raw-zlib perl-dbi perl-dbd-mysql \ |
pascal@20179 | 37 perl-apache-dbi perl-net-ip perl-soap-lite \ |
pascal@20179 | 38 perl-xml-parser perl-xml-sax-writer apache-mod-perl" |
al@21020 | 39 mkdir -p $fs/usr |
al@21020 | 40 cp -a $install/usr/lib $fs/usr |
pascal@20179 | 41 |
al@21020 | 42 install -o www -g www -m 0775 -d $fs/var/log/ocsinventory-server |
al@21020 | 43 install -o root -g www -m 0775 -d $fs/var/lib/ocsinventory-server/ipd |
al@21020 | 44 install -o root -g www -m 0775 -d $fs/var/lib/ocsinventory-server/download |
al@21020 | 45 |
al@21020 | 46 mkdir -p $fs/etc/logrotate.d |
al@21020 | 47 cp -f $src/etc/logrotate.d/ocsinventory-server \ |
al@21020 | 48 $fs/etc/logrotate.d/ocsinventory-server |
al@21020 | 49 sed -i "s#PATH_TO_LOG_DIRECTORY#/var/log/ocsinventory-server#g" \ |
al@21020 | 50 $fs/etc/logrotate.d/ocsinventory-server |
al@21020 | 51 |
al@21020 | 52 mkdir -p $fs/etc/apache/conf.d |
al@21020 | 53 cp $src/etc/ocsinventory/ocsinventory-server.conf \ |
al@21020 | 54 $fs/etc/apache/conf.d/ocsinventory-server.conf |
al@21068 | 55 sed \ |
al@21020 | 56 -e "s#DATABASE_SERVER#localhost#g" \ |
al@21020 | 57 -e "s#DATABASE_PORT#3306#g" \ |
al@21020 | 58 -e "s#VERSION_MP#2#g" \ |
al@21020 | 59 -e "s#PATH_TO_LOG_DIRECTORY#/var/log/ocsinventory-server#g" \ |
al@21020 | 60 -i $fs/etc/apache/conf.d/ocsinventory-server.conf |
al@21020 | 61 |
al@21020 | 62 if ! grep -q mod_perl.so $fs/etc/apache/conf.d/ocsinventory-server.conf; then |
al@21020 | 63 cat > $fs/etc/apache/conf.d/ocsinventory-server.tmp <<EOT |
pascal@20179 | 64 <IfModule !mod_perl.c> |
pascal@20179 | 65 loadmodule perl_module share/apache/modules/mod_perl.so |
pascal@20179 | 66 </IfModule> |
pascal@20179 | 67 |
pascal@20179 | 68 $(cat $fs/etc/apache/conf.d/ocsinventory-server.conf) |
pascal@20179 | 69 EOT |
al@21020 | 70 mv $fs/etc/apache/conf.d/ocsinventory-server.tmp \ |
al@21020 | 71 $fs/etc/apache/conf.d/ocsinventory-server |
al@21020 | 72 [ -f $fs/etc/apache/conf.d/ocsinventory-server.conf ] && |
al@21020 | 73 rm -f $fs/etc/apache/conf.d/ocsinventory-server.conf |
al@21020 | 74 fi |
al@21020 | 75 ;; |
al@21020 | 76 ocsreports) |
al@21020 | 77 CAT="network|Inventory and package deployement system" |
al@21020 | 78 TAGS="system administration" |
al@21020 | 79 DEPENDS="php-apache php-mysql mysql" |
al@21020 | 80 mkdir -p $fs/usr/share \ |
al@21020 | 81 $fs/etc/ocsreports |
al@21020 | 82 |
al@21020 | 83 cp -a $src/$PACKAGE $fs/usr/share/ |
al@21020 | 84 cat > $fs/etc/ocsreports/dbconfig.inc.php <<EOT |
pascal@20179 | 85 <?php |
pascal@20179 | 86 define("DB_NAME", "ocsweb"); |
pascal@20179 | 87 define("SERVER_READ","localhost"); |
pascal@20179 | 88 define("SERVER_WRITE","localhost"); |
pascal@20179 | 89 define("COMPTE_BASE","ocs"); |
pascal@20179 | 90 define("PSWD_BASE","ocs"); |
pascal@20179 | 91 ?> |
pascal@20179 | 92 EOT |
pascal@20179 | 93 |
al@21020 | 94 install -o root -g www -m 0755 $src/binutils/*.pl \ |
al@21020 | 95 $fs/usr/share/ocsreports/ |
pascal@20179 | 96 |
al@21020 | 97 rm -f $fs/usr/share/$PACKAGE/dbconfig.inc.php |
al@21020 | 98 cd $fs/usr/share/$PACKAGE |
al@21020 | 99 ln -s /etc/ocsreports/dbconfig.inc.php |
al@21020 | 100 cd - |
al@21020 | 101 |
al@21020 | 102 # Remove doc file. |
al@21020 | 103 rm -f $fs/usr/share/ocsreports/files/*.pdf |
al@21020 | 104 ;; |
pascal@20179 | 105 esac |
erjo@3673 | 106 } |
pascal@20179 | 107 |
al@21020 | 108 post_install_ocsinventory_server() { |
pascal@20179 | 109 if [ -z "$1" ]; then |
pascal@20179 | 110 echo "Now you can connect to http://$(hostname)/ocsreports" |
pascal@20179 | 111 # Restart Apache if is running |
pascal@20179 | 112 [ -f /var/run/apache/httpd.pid ] && /etc/init.d/apache reload |
pascal@20179 | 113 fi |
pascal@20179 | 114 } |
pascal@20179 | 115 |
al@21020 | 116 post_install_ocsreports() { |
pascal@20179 | 117 # Configure apache server |
pascal@20179 | 118 if [ -f "$1/etc/apache/httpd.conf" ]; then |
pascal@20179 | 119 if [ ! -f "$1/etc/apache/conf.d/$PACKAGE" ]; then |
pascal@20179 | 120 cat > "$1/etc/apache/conf.d/$PACKAGE" <<EOT |
pascal@20179 | 121 <IfModule mod_alias.c> |
pascal@20179 | 122 Alias /$PACKAGE /usr/share/$PACKAGE/ |
pascal@20179 | 123 </IfModule> |
pascal@20179 | 124 <Directory "/usr/share/$PACKAGE"> |
pascal@20179 | 125 Options Indexes FollowSymLinks |
pascal@20179 | 126 AllowOverride None |
pascal@20179 | 127 Order deny,allow |
pascal@20179 | 128 Allow from all |
pascal@20179 | 129 </Directory> |
pascal@20179 | 130 |
pascal@20179 | 131 EOT |
pascal@20179 | 132 if [ -z "$1" ]; then |
pascal@20179 | 133 # Start Web server. |
al@21020 | 134 test -f /var/run/apache/httpd.pid && |
pascal@20179 | 135 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart ) |
pascal@20179 | 136 fi |
pascal@20179 | 137 fi |
pascal@20179 | 138 fi |
pascal@20179 | 139 |
pascal@20179 | 140 # Configure every thing for ocsweb. |
pascal@20179 | 141 if [ -z "$1" ]; then |
pascal@20179 | 142 if ( ! mysqladmin -s ping > /dev/null ); then |
pascal@20179 | 143 echo "Starting MySQL server" |
al@21020 | 144 ( /etc/init.d/mysql start; status ) || exit |
pascal@20179 | 145 sleep 4 #let the mysql daemon start |
pascal@20179 | 146 fi |
al@21020 | 147 |
pascal@20179 | 148 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then |
al@21020 | 149 action "Create $PACKAGE database and schema" |
al@21020 | 150 mysql -Be "create database ocsweb CHARACTER SET utf8 COLLATE utf8_bin" |
al@21020 | 151 status |
al@21020 | 152 |
pascal@20179 | 153 mysql -s -u root ocsweb < /usr/share/$PACKAGE/files/ocsbase_new.sql > /dev/null 2>&1 |
al@21020 | 154 |
pascal@20179 | 155 # We suppose that ocs user does not exist. |
pascal@20179 | 156 # It may be false. |
al@21020 | 157 action "Create user ocs with password ocs" |
al@21020 | 158 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost' |
al@21020 | 159 identified by 'ocs'" |
al@21020 | 160 status |
pascal@20179 | 161 fi |
pascal@20179 | 162 fi |
pascal@20179 | 163 true |
pascal@20179 | 164 } |
pascal@20179 | 165 |
al@21020 | 166 post_remove_ocsreports() { |
al@21020 | 167 [ -z "$1" ] || return |
pascal@20179 | 168 |
al@21020 | 169 echo -n "Would you like to remove data and database files.(y/n) " |
al@21020 | 170 read answer |
pascal@20179 | 171 |
al@21020 | 172 case $answer in |
pascal@20179 | 173 y|Y) |
al@21020 | 174 acrion "Removing data directories..." |
pascal@20179 | 175 rm -rf /usr/share/ocsreports |
al@21020 | 176 status |
al@21020 | 177 |
pascal@20179 | 178 if ( mysql -Be 'show databases' | grep -q ocsweb ); then |
al@21020 | 179 action "Deleting ocsreports database" |
al@21020 | 180 mysql -u root -Be "drop database ocsweb;" |
al@21020 | 181 status |
al@21020 | 182 |
al@21020 | 183 action "Delete user ocs" |
al@21020 | 184 mysql -u root -Be "delete from mysql.db where user=ocs;" |
al@21020 | 185 status |
pascal@20179 | 186 fi |
pascal@20179 | 187 ;; |
al@21020 | 188 esac |
al@21020 | 189 unset $answer |
pascal@20179 | 190 } |