--- a/debian/scripts/koha-remove +++ a/debian/scripts/koha-remove @@ -19,9 +19,26 @@ set -e +NAMES="$@" -for name in "$@" +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/\ .\ //` + +if [ -z $NAMES ] ; then + echo "Please specify a Koha instance name. Your choices are:" + echo "$INSTANCES" + exit 1 +fi + +for name in $NAMES do + # 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 + echo "Removing Koha instance $name" mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <