diff --git a/debian/cdrtool.postinst b/debian/cdrtool.postinst old mode 100644 new mode 100755 index 6371a2e..a17fdf4 --- a/debian/cdrtool.postinst +++ b/debian/cdrtool.postinst @@ -1,56 +1,55 @@ #! /bin/sh # # $Id: cdrtool.postinst,v 1.4 2006-08-06 15:29:17 adigeo Exp $ set -e # The loading of the confmodule is needed for debconf to work. don't remove . /usr/share/debconf/confmodule # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # # quoting from the policy: # Any necessary prompting should almost always be confined to the # post-installation script, and should be protected with a conditional # so that unnecessary prompting doesn't happen if a package's # installation fails and the `postinst' is called with `abort-upgrade', # `abort-remove' or `abort-deconfigure'. case "$1" in configure) find /var/www/CDRTool/scripts/ -name \*.php -exec chmod +x {} \; chmod g+w /var/www/CDRTool/templates_c chgrp www-data /var/www/CDRTool/templates_c chgrp www-data /var/spool/cdrtool/normalize chmod g+sw /var/spool/cdrtool/normalize ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # 'debhelper' is not used here to avoid automatically starting cdrtool after # the installation. Instead we will use the user supplied answer about # starting on boot #DEBHELPER# exit 0 - diff --git a/debian/cdrtool.postrm b/debian/cdrtool.postrm old mode 100644 new mode 100755 index fe49c92..9d34fce --- a/debian/cdrtool.postrm +++ b/debian/cdrtool.postrm @@ -1,47 +1,46 @@ #! /bin/sh # $Id: cdrtool.postrm,v 1.5 2006-08-06 15:29:17 adigeo Exp $ # postrm script for cdrtool # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `purge' # * `upgrade' # * `failed-upgrade' # * `abort-install' # * `abort-install' # * `abort-upgrade' # * `disappear' overwrit>r> # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# if [ "$1" = "purge" ] ; then rm -f /etc/apache/conf.d/cdrtool && true rm -f /etc/apache2/conf.d/cdrtool && true rm -rf /var/www/CDRTool rmdir /etc/cdrtool 2>/dev/null || true - fi exit 0 diff --git a/debian/rules b/debian/rules old mode 100644 new mode 100755 index a4e20db..eb19a5d --- a/debian/rules +++ b/debian/rules @@ -1,92 +1,93 @@ #!/usr/bin/make -f # -*- mode: makefile; coding: utf-8 -*- + #export DH_VERBOSE=1 export DH_ALWAYS_EXCLUDE=_darcs configure: configure-stamp configure-stamp: dh_testdir touch configure-stamp build-arch: build-stamp build-indep: build-stamp build: build-stamp build-stamp: configure-stamp dh_testdir touch build-stamp clean: dh_testdir dh_testroot dh_clean rm -f build-stamp configure-stamp install: build dh_testdir dh_testroot dh_prep dh_installdirs cp -a doc debian/cdrtool/usr/share/doc/cdrtool/ cp -a setup/*sample debian/cdrtool/etc/cdrtool/ cp -a debian/copyright debian/cdrtool/usr/share/doc/cdrtool/ cp -a setup/csv debian/cdrtool/usr/share/doc/cdrtool/rating-sample-files cp -a images debian/cdrtool/var/www/CDRTool/ cp -a library debian/cdrtool/var/www/CDRTool/ cp -a templates debian/cdrtool/var/www/CDRTool/ cp -a contrib debian/cdrtool/var/www/CDRTool/ cp -a doc debian/cdrtool/var/www/CDRTool/ cp -a phplib debian/cdrtool/var/www/CDRTool/ cp -a scripts debian/cdrtool/var/www/CDRTool/ cp -a setup debian/cdrtool/var/www/CDRTool/ cp -a status debian/cdrtool/var/www/CDRTool/ cp -a po debian/cdrtool/var/www/CDRTool/ cp -a *.js debian/cdrtool/var/www/CDRTool/ cp -a timezones debian/cdrtool/var/www/CDRTool/ cp -a version debian/cdrtool/var/www/CDRTool/ cp -a .htaccess debian/cdrtool/var/www/CDRTool/ cp *.phtml debian/cdrtool/var/www/CDRTool/ cp *.css debian/cdrtool/var/www/CDRTool/ cp debian/changelog debian/cdrtool/var/www/CDRTool/doc/ cp -a bootstrap debian/cdrtool/var/www/CDRTool/ # Build architecture-dependent files here. binary-arch: build install # We have nothing to do by default. # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_installchangelogs dh_lintian # dh_installdocs dh_installexamples # dh_install # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_python dh_installinit dh_installcron # dh_installinfo # dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl # dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure diff --git a/makedist b/makedist index a50b073..c3a22f4 100755 --- a/makedist +++ b/makedist @@ -1,41 +1,40 @@ #!/usr/bin/env sh if [ ! -f library/cdr_generic.php ]; then echo "Run this program inside the CDRTool directory" exit 1 fi style="" pkgignore=".pkgignorelite" if [ $# -eq 1 -a "$1" = "full" ]; then style="_full" pkgignore=".pkgignore" fi dirname=`basename $PWD` basedir=`dirname $PWD` version=`cat version` archive="CDRTool-$version$style.tar.gz" if [ "$dirname" != "CDRTool" ]; then create=1 else create=0 fi if [ $create -eq 1 ]; then (cd ../; ln -s "$dirname" CDRTool) fi echo "Creating $archive" GZIP=--best tar --exclude-from=$pkgignore --directory ../ -zchf "$archive" CDRTool if [ $create -eq 1 ]; then rm ../CDRTool fi - diff --git a/setup/init.d/cdrtool b/setup/init.d/cdrtool index c731553..f68eaf5 100755 --- a/setup/init.d/cdrtool +++ b/setup/init.d/cdrtool @@ -1,77 +1,77 @@ #! /bin/sh # ### BEGIN INIT INFO # Provides: cdrtool # Required-Start: $syslog $network $local_fs $time # Required-Stop: $syslog $network $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start the CDRTool rating engine # Description: Start the CDRTool rating engine ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin CDRTOOL_PATH=/var/www/CDRTool DAEMON=$CDRTOOL_PATH/scripts/ratingEngine.php NAME=cdrtool DESC=cdrtool RUN_ratingEngine=no . /lib/lsb/init-functions test -x $DAEMON || exit 0 # Include cdrtool defaults if available if [ -f /etc/default/cdrtool ] ; then - . /etc/default/cdrtool + . /etc/default/cdrtool fi if [ "$RUN_ratingEngine" != "yes" ]; then echo "CDRTool is not yet configured. Edit /etc/default/cdrtool first." exit 0 fi set -e start() { echo -n "Starting CDRTool $DESC" start-stop-daemon --start --background --quiet --pidfile /var/run/ratingEngine.pid \ --exec $DAEMON -- $DAEMON_OPTS echo "." } stop () { echo -n "Stopping CDRTool $DESC" start-stop-daemon --stop --quiet --oknodo --signal 15 --pidfile /var/run/ratingEngine.pid echo "." } reload () { echo -n "Reloading CDRTool rating tables:" echo $CDRTOOL_PATH/scripts/reloadRatingTables.php && true } case "$1" in start) start ;; stop) stop ;; reload|force-reload) reload ;; restart) stop #sleep 1 start ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0 diff --git a/setup/mysql/setup_mysql.sh b/setup/mysql/setup_mysql.sh index cd534d8..9a3743a 100755 --- a/setup/mysql/setup_mysql.sh +++ b/setup/mysql/setup_mysql.sh @@ -1,35 +1,35 @@ #!/usr/bin/env sh db=cdrtool if test $# != 2; then echo "setup_mysql.sh DB_ROOT_PASSWORD DB_HOST" exit; fi grep \'PASSWORD\' create_users.mysql | grep -i grant > /dev/null if test $? = 0 ; then echo "Please edit create_users.mysql and replace the PASSWORD with a new password and try again" exit 1 fi grep \'PRIVATE_IP_NETWORK\' create_users.mysql | grep -i grant > /dev/null if test $? = 0 ; then echo "Please edit create_users.mysql and replace the PRIVATE_IP_NETWORK with real addresses and try again" exit 1 fi mysqladmin -u root -p$1 -h $2 create $db -if test $? = 0 ; then +if test $? = 0; then mysql -u root -p$1 -h $2 mysql < ./create_users.mysql mysql -u root -p$1 -h $2 $db < ./create_tables.mysql mysql -u root -p$1 -h $2 $db < ./create_data.mysql -else +else echo "Failed to create $db database on host $2" exit 1 fi exit 0