Bugzilla – Attachment 6336 Details for
Bug 6684
koha-remove should check the number of arguments it gets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to bugs 6684 6997 4880
0001-Patches-to-bugs-6684-6997-4880.patch (text/plain), 3.41 KB, created by
Simon Story
on 2011-11-18 15:01:40 UTC
(
hide
)
Description:
Patch to bugs 6684 6997 4880
Filename:
MIME Type:
Creator:
Simon Story
Created:
2011-11-18 15:01:40 UTC
Size:
3.41 KB
patch
obsolete
>From 2a73c496bff1a5ffa840de0f7247c909a2dcacab Mon Sep 17 00:00:00 2001 >From: Simon Story <simon.story@catalyst-eu.net> >Date: Fri, 18 Nov 2011 14:52:09 +0000 >Subject: [PATCH] Patches to bugs 6684 6997 4880 > 6684 koha-remove should check the number of arguments it gets > 6997 koha-remove leaves system in inconsistent state if there is an error > 4880 koha-remove sometimes fails because user is logged intkoha-remove sometimes fails because user is logged in > >--- > debian/scripts/koha-remove | 54 +++++++++++++++++++++++++++++++------------ > 1 files changed, 39 insertions(+), 15 deletions(-) > >diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove >index 10a8b78..be91c8b 100755 >--- a/debian/scripts/koha-remove >+++ b/debian/scripts/koha-remove >@@ -19,30 +19,54 @@ > > 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" > >+ # The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted. > mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof >+GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`; > DROP USER \`koha_$name\`; >-DROP DATABASE \`koha_$name\`; >+DROP DATABASE IF EXISTS \`koha_$name\`; > FLUSH PRIVILEGES; > eof > >- koha-stop-zebra $name >- rm "/etc/apache2/sites-available/$name" >- rm "/etc/koha/sites/$name/koha-conf.xml" >- rm "/etc/koha/sites/$name/zebra-biblios.cfg" >- rm "/etc/koha/sites/$name/zebra-authorities.cfg" >- rm "/etc/koha/sites/$name/zebra-authorities-dom.cfg" >- rm "/etc/koha/sites/$name/zebra.passwd" >- rmdir "/etc/koha/sites/$name" >- rm -r "/var/lock/koha/$name" >- rm -r "/var/log/koha/$name" >- rm -r "/var/run/koha/$name" >- deluser --quiet "$name-koha" >- a2dissite "$name" >+ # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. >+ koha-stop-zebra $name | /bin/true >+ rm -f "/etc/apache2/sites-available/$name" >+ rm -f "$SITECONFDIR/$name/koha-conf.xml" >+ rm -f "$SITECONFDIR/$name/zebra-biblios.cfg" >+ rm -f "$SITECONFDIR/$name/zebra-authorities.cfg" >+ rm -f "$SITECONFDIR/$name/zebra-authorities-dom.cfg" >+ rm -f "$SITECONFDIR/$name/zebra.passwd" >+ # Maybe a user has left something in the config directory they want to keep? We won't delete it here, nor throw an error if they have. >+ rmdir --ignore-fail-on-non-empty "$SITECONFDIR/$name" >+ rm -rf "/var/lock/koha/$name" >+ rm -rf "/var/log/koha/$name" >+ rm -rf "/var/run/koha/$name" >+ # Frequently warns about the mailspool dir. Sometimes the daemon has not stopped yet. So work around the non-zero result code. >+ echo "Deleting Koha user for $name" >+ userdel --force --remove "$name-koha" &> /dev/null | /bin/true >+ # 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 >-- >1.7.2.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6684
:
6320
|
6336
|
9003
|
9533