X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=debian%2Fscripts%2Fkoha-remove;h=3fa5ef167d58ce7583628f9972d019391b26c867;hb=568f32606c2c9c247b2b477193a2d6814f738fa6;hp=728f996e400fc362724f24c5ca292a37820f6a37;hpb=14c5540ab87519f750bac402974788dd4834d88f;p=koha.git diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove index 728f996e40..3fa5ef167d 100755 --- a/debian/scripts/koha-remove +++ b/debian/scripts/koha-remove @@ -19,28 +19,81 @@ set -e +args=$(getopt -l keep-mysql -o k -n $0 -- "$@") +eval set -- $args +while [ ! -z "$1" ] +do + case "$1" in + -k|--keep-mysql) keepmysql=1; shift;; + --) shift; break;; + *) break;; + esac + shift +done + +NAMES="$@" + +SITECONFDIR="/etc/koha/sites" +# There has to be a better way of excluding '.' from find. But this works. +INSTANCES=`cd $SITECONFDIR && find . -type d -printf " %f" |sed s/\ .\ //` -for name in "$@" +if [ -z $NAMES ] ; then + echo "Please specify a Koha instance name. Your choices are:" + echo "$INSTANCES" + exit 1 +fi + +for name in $NAMES do - echo "Removing Koha instance $name" + # Does the directory (ie instance) name exist? + if [ ! -d $SITECONFDIR/$name ] ; then + echo Koha configuration directory for instance \"$name\" does not exist, please specify a valid Koha instance + exit 1 + fi - mysql --defaults-extra-file=/etc/mysql/debian.cnf < /dev/null && deluser --quiet "$name-koha" + # in case the site has already been disabled, we don't want to break the loop now. + a2dissite "$name" || /bin/true done service apache2 restart