wok-next diff nconf/receipt @ rev 21020
Cleaning is almost finished... I should proceed to upgrades.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Nov 02 14:15:08 2018 +0200 (2018-11-02) |
parents | 9e01bc6321ea |
children |
line diff
1.1 --- a/nconf/receipt Sun Dec 20 15:13:45 2015 +0100 1.2 +++ b/nconf/receipt Fri Nov 02 14:15:08 2018 +0200 1.3 @@ -4,17 +4,14 @@ 1.4 VERSION="1.3.0-0" 1.5 CATEGORY="system-tools" 1.6 SHORT_DESC="Enterprise Nagios configurator" 1.7 -MAINTAINER="erjo@slitaz.org" 1.8 +MAINTAINER="devel@slitaz.org" 1.9 LICENSE="GPL2" 1.10 +WEB_SITE="http://www.nconf.org/dokuwiki/doku.php" 1.11 + 1.12 TARBALL="$PACKAGE-$VERSION.tgz" 1.13 -WEB_SITE="http://www.nconf.org/dokuwiki/doku.php" 1.14 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" 1.15 1.16 -DEPENDS="mysql php-apache nagios perl perl-dbi perl-dbd-mysql" 1.17 - 1.18 -# Rules to gen a SliTaz package suitable for Tazpkg. 1.19 -genpkg_rules() 1.20 -{ 1.21 +genpkg_rules() { 1.22 mkdir -p $fs/usr/share/nconf \ 1.23 $fs/var/lib/nconf \ 1.24 $fs/etc/nconf \ 1.25 @@ -22,20 +19,20 @@ 1.26 $fs/etc/nagios/import 1.27 1.28 cp $stuff/apache2-nconf.conf $fs/etc/apache/conf.d 1.29 - 1.30 + 1.31 # Copy files 1.32 cp -a $src/* $fs/usr/share/nconf 1.33 - 1.34 + 1.35 # Move config, output, static_cfg, temp tor $fs/var/lib/nconf (FHS) 1.36 # and link them to $fs/usr/sahre/nconf 1.37 cp -a $fs/usr/share/nconf/config.orig/* $fs/etc/nconf 1.38 mv $fs/usr/share/nconf/output $fs/var/lib/nconf 1.39 mv $fs/usr/share/nconf/static_cfg $fs/var/lib/nconf 1.40 mv $fs/usr/share/nconf/temp $fs/var/lib/nconf 1.41 - 1.42 + 1.43 chown -R www.www $fs/usr/share/nconf \ 1.44 $fs/var/lib/nconf 1.45 - 1.46 + 1.47 ln -s /etc/nconf/authentication.php $fs/usr/share/nconf/config 1.48 ln -s /etc/nconf/main.php $fs/usr/share/nconf/config 1.49 ln -s /etc/nconf/mysql.php $fs/usr/share/nconf/config 1.50 @@ -43,12 +40,12 @@ 1.51 ln -s /var/lib/nconf/output $fs/usr/share/nconf/ 1.52 ln -s /var/lib/nconf/static_cfg $fs/usr/share/nconf/ 1.53 ln -s /var/lib/nconf/temp $fs/usr/share/nconf/ 1.54 - 1.55 + 1.56 mv $fs/usr/share/nconf/INSTALL $fs/var/lib/nconf 1.57 # Cleanup 1.58 rm -rf $fs/usr/share/nconf/UPDATE* 1.59 rm -f $fs/usr/share/nconf/INSTALL.php 1.60 - 1.61 + 1.62 # Set default settings 1.63 sed -i -e 's/Nconf/nconf/' -e 's/link2db/nconf/' $fs/etc/nconf/mysql.php 1.64 sed -i -e '/NCONFDIR/ s|/var/www|/usr/share|' \ 1.65 @@ -58,64 +55,72 @@ 1.66 sed -i -e 's|bash|sh|' -e '/OUTPUT_DIR/ s|/var/www/html|/usr/share|' \ 1.67 -e '/NAGIOS_DIR/ s|NAGIOS_DIR=.*|NAGIOS_DIR=\"/etc/nagios\"|' $fs/usr/share/nconf/ADD-ONS/deploy_local.sh 1.68 sed -i -e 's|bash|sh|' -e '/DBNAME/ s|NConf|nconf|' $fs/usr/share/nconf/ADD-ONS/history_cleanup.sh 1.69 + DEPENDS="mysql php-apache nagios perl perl-dbi perl-dbd-mysql" 1.70 } 1.71 1.72 -post_install() 1.73 -{ 1.74 +post_install() { 1.75 local db=nconf 1.76 local db_user=nconf 1.77 local db_password=nconf 1.78 local sql_script='/var/lib/nconf/INSTALL/create_database.sql' 1.79 - 1.80 + 1.81 # Minimal config for NConf. 1.82 if [ -z "$1" ]; then 1.83 if ( ! mysqladmin -s ping > /dev/null ); then 1.84 echo "Starting MySQL server" 1.85 - ( /etc/init.d/mysql start ; status ) || exit 1.86 + ( /etc/init.d/mysql start; status ) || exit 1.87 sleep 4 #let the mysql daemon start 1.88 fi 1.89 + 1.90 if ( ! mysql -u root -Be 'show databases' | grep -q $db ); then 1.91 - echo -n "Create $db database" 1.92 - mysql -Be "create database $db" ; status 1.93 + action "Create $db database" 1.94 + mysql -Be "create database $db" 1.95 + status 1.96 + 1.97 # We suppose that $DB_USER user does not exist. 1.98 # It may be false. 1.99 - echo -n "Create user $db_user with password $db_password" 1.100 - mysql -Be "grant all privileges on $db.* to '"$db_user"'@'localhost' 1.101 - identified by '"$db_password"'" ; status 1.102 + action "Create user $db_user with password $db_password" 1.103 + mysql -Be "grant all privileges on $db.* to '"$db_user"'@'localhost' 1.104 + identified by '"$db_password"'" 1.105 + status 1.106 + 1.107 # At last create the database for $PACKAGE. 1.108 - echo -n "Create $db database schema." 1.109 - mysql -u $db_user -p${db_password} -D $db < $sql_script ; status 1.110 + action "Create $db database schema." 1.111 + mysql -u $db_user -p$db_password -D $db < $sql_script 1.112 + status 1.113 fi 1.114 fi 1.115 true 1.116 } 1.117 1.118 -post_remove() 1.119 -{ 1.120 +post_remove() { 1.121 if [ -z "$1" ]; then 1.122 local db=nconf 1.123 local db_user=nconf 1.124 local db_password=nconf 1.125 - 1.126 - echo -n "Would you like to remove data and database files.(y/n) " 1.127 + 1.128 + echo -en "\nWould you like to remove data and database files.(y/n) " 1.129 read answer 1.130 1.131 - case $answer in 1.132 - y|Y) 1.133 - echo -n "Removing data directories..." 1.134 - rm -rf /var/lib/nconf ; status 1.135 - if ( mysql -u root -Be 'show databases' | grep -q $db ); then 1.136 - echo -n "Deleting $db database" 1.137 - mysql -Be "drop database $db" ; status 1.138 - # We suppose that $db_user user does not exist. 1.139 - # It may be false. 1.140 - echo -n "Delete user $db_user" 1.141 - mysql -Be "delete from mysql.db where user='"$db_user"'" ; status 1.142 + case $answer in 1.143 + y|Y) 1.144 + action "Removing data directories..." 1.145 + rm -rf /var/lib/nconf 1.146 + status 1.147 + 1.148 + if ( mysql -u root -Be 'show databases' | grep -q $db ); then 1.149 + action "Deleting $db database" 1.150 + mysql -Be "drop database $db" 1.151 + status 1.152 + 1.153 + # We suppose that $db_user user does not exist. 1.154 + # It may be false. 1.155 + action "Delete user $db_user" 1.156 + mysql -Be "delete from mysql.db where user='"$db_user"'" 1.157 + status 1.158 fi 1.159 - unset answer 1.160 - ;; 1.161 - *) 1.162 ;; 1.163 esac 1.164 + unset answer 1.165 fi 1.166 }