wok annotate nconf/receipt @ rev 25185

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