wok-next view nconf/receipt @ rev 21402
updated php (7.4.4 -> 7.4.5)
author | Hans-G?nter Theisgen |
---|---|
date | Tue Apr 21 07:47:41 2020 +0100 (2020-04-21) |
parents | 9e01bc6321ea |
children |
line source
1 # SliTaz package receipt.
3 PACKAGE="nconf"
4 VERSION="1.3.0-0"
5 CATEGORY="system-tools"
6 SHORT_DESC="Enterprise Nagios configurator"
7 MAINTAINER="devel@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="http://www.nconf.org/dokuwiki/doku.php"
11 TARBALL="$PACKAGE-$VERSION.tgz"
12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
14 genpkg_rules() {
15 mkdir -p $fs/usr/share/nconf \
16 $fs/var/lib/nconf \
17 $fs/etc/nconf \
18 $fs/etc/apache/conf.d \
19 $fs/etc/nagios/import
21 cp $stuff/apache2-nconf.conf $fs/etc/apache/conf.d
23 # Copy files
24 cp -a $src/* $fs/usr/share/nconf
26 # Move config, output, static_cfg, temp tor $fs/var/lib/nconf (FHS)
27 # and link them to $fs/usr/sahre/nconf
28 cp -a $fs/usr/share/nconf/config.orig/* $fs/etc/nconf
29 mv $fs/usr/share/nconf/output $fs/var/lib/nconf
30 mv $fs/usr/share/nconf/static_cfg $fs/var/lib/nconf
31 mv $fs/usr/share/nconf/temp $fs/var/lib/nconf
33 chown -R www.www $fs/usr/share/nconf \
34 $fs/var/lib/nconf
36 ln -s /etc/nconf/authentication.php $fs/usr/share/nconf/config
37 ln -s /etc/nconf/main.php $fs/usr/share/nconf/config
38 ln -s /etc/nconf/mysql.php $fs/usr/share/nconf/config
39 ln -s /etc/nconf/nconf.php $fs/usr/share/nconf/config
40 ln -s /var/lib/nconf/output $fs/usr/share/nconf/
41 ln -s /var/lib/nconf/static_cfg $fs/usr/share/nconf/
42 ln -s /var/lib/nconf/temp $fs/usr/share/nconf/
44 mv $fs/usr/share/nconf/INSTALL $fs/var/lib/nconf
45 # Cleanup
46 rm -rf $fs/usr/share/nconf/UPDATE*
47 rm -f $fs/usr/share/nconf/INSTALL.php
49 # Set default settings
50 sed -i -e 's/Nconf/nconf/' -e 's/link2db/nconf/' $fs/etc/nconf/mysql.php
51 sed -i -e '/NCONFDIR/ s|/var/www|/usr/share|' \
52 -e '/NAGIOS_BIN/ s|/var/www/nconf/bin|/usr/bin|' $fs/etc/nconf/mysql.php
54 # Fix add-ons scripts
55 sed -i -e 's|bash|sh|' -e '/OUTPUT_DIR/ s|/var/www/html|/usr/share|' \
56 -e '/NAGIOS_DIR/ s|NAGIOS_DIR=.*|NAGIOS_DIR=\"/etc/nagios\"|' $fs/usr/share/nconf/ADD-ONS/deploy_local.sh
57 sed -i -e 's|bash|sh|' -e '/DBNAME/ s|NConf|nconf|' $fs/usr/share/nconf/ADD-ONS/history_cleanup.sh
58 DEPENDS="mysql php-apache nagios perl perl-dbi perl-dbd-mysql"
59 }
61 post_install() {
62 local db=nconf
63 local db_user=nconf
64 local db_password=nconf
65 local sql_script='/var/lib/nconf/INSTALL/create_database.sql'
67 # Minimal config for NConf.
68 if [ -z "$1" ]; then
69 if ( ! mysqladmin -s ping > /dev/null ); then
70 echo "Starting MySQL server"
71 ( /etc/init.d/mysql start; status ) || exit
72 sleep 4 #let the mysql daemon start
73 fi
75 if ( ! mysql -u root -Be 'show databases' | grep -q $db ); then
76 action "Create $db database"
77 mysql -Be "create database $db"
78 status
80 # We suppose that $DB_USER user does not exist.
81 # It may be false.
82 action "Create user $db_user with password $db_password"
83 mysql -Be "grant all privileges on $db.* to '"$db_user"'@'localhost'
84 identified by '"$db_password"'"
85 status
87 # At last create the database for $PACKAGE.
88 action "Create $db database schema."
89 mysql -u $db_user -p$db_password -D $db < $sql_script
90 status
91 fi
92 fi
93 true
94 }
96 post_remove() {
97 if [ -z "$1" ]; then
98 local db=nconf
99 local db_user=nconf
100 local db_password=nconf
102 echo -en "\nWould you like to remove data and database files.(y/n) "
103 read answer
105 case $answer in
106 y|Y)
107 action "Removing data directories..."
108 rm -rf /var/lib/nconf
109 status
111 if ( mysql -u root -Be 'show databases' | grep -q $db ); then
112 action "Deleting $db database"
113 mysql -Be "drop database $db"
114 status
116 # We suppose that $db_user user does not exist.
117 # It may be false.
118 action "Delete user $db_user"
119 mysql -Be "delete from mysql.db where user='"$db_user"'"
120 status
121 fi
122 ;;
123 esac
124 unset answer
125 fi
126 }