wok-next annotate nconf/receipt @ rev 21469

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