Bug 9754: koha-remove optionally includes var/lib and var/spool
Currently, the files in the folder /var/lib/koha/[instance] and also
in /var/spool/koha/[instance] are not removed.
This patch adds the option -p|--purge-all to include those two
directories when removing files.
Note: There was a small bug in the for loop. On the -k line the extra
shift statement is one too much.
NOTE: Verify that you use the adjusted koha-remove in the test plan
and not accidentally an older version of this script.
Test plan:
[1] Create an instance test.
[2] Run koha-remove and verify that /var/lib/koha/test still exists.
[3] Create an instance test2.
[4] Run koha-remove -k -p and verify that the sql database still exists
but the two instance folders in var/lib/koha and var/spool/koha are
gone.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit 1d99fa026b)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
(cherry picked from commit 69fd29942c)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
parent
11796d60fa
commit
c5cb615f9c
|
|
@ -27,12 +27,14 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
args=$(getopt -l keep-mysql -o k -n $0 -- "$@")
|
||||
args=$(getopt -l keep-mysql,purge-all -o kp -n $0 -- "$@")
|
||||
eval set -- $args
|
||||
while [ ! -z "$1" ]
|
||||
do
|
||||
case "$1" in
|
||||
-k|--keep-mysql) keepmysql=1; shift;;
|
||||
-k|--keep-mysql) keepmysql=1;;
|
||||
-p|--purge-all) purgeall=1;;
|
||||
# purgeall removes all instance files in var/lib/koha and var/spool/koha
|
||||
--) shift; break;;
|
||||
*) break;;
|
||||
esac
|
||||
|
|
@ -102,6 +104,10 @@ eof
|
|||
rm -r "/var/log/koha/$name"
|
||||
[ -d "/var/run/koha/$name" ] && \
|
||||
rm -r "/var/run/koha/$name"
|
||||
[ "$purgeall" = "1" ] && [ -d "/var/lib/koha/$name" ] && \
|
||||
rm -r "/var/lib/koha/$name"
|
||||
[ "$purgeall" = "1" ] && [ -d "/var/spool/koha/$name" ] && \
|
||||
rm -r "/var/spool/koha/$name"
|
||||
getent passwd "$name-koha" > /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" > /dev/null 2>&1 || a2dissite "${name}.conf" > /dev/null 2>&1 || /bin/true
|
||||
|
|
|
|||
Loading…
Reference in New Issue