-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswiqlisp-uninstall
executable file
·93 lines (77 loc) · 2.91 KB
/
swiqlisp-uninstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Copyright © 2011 Sebastian D. Tennant <[email protected]>
#
# This file is part of swiQlisp — site-wide Quicklisp.
#
# swiQlisp is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# swiQlisp is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# swiQlisp. If not, see <http://www.gnu.org/licenses/>
# Commentary:
#
# This script (swiqlisp-uninstall) is the site-wide Quicklisp removal tool.
#
# Use the script 'swiqlisp' to manage your site-wide Quicklisp installation on
# a day-to-day basis.
#-------------------------------------------------------------------------------
# utility function
ensure_no_trailing_slash () {
if test ${1: -1} = /; then echo -n ${1:0: -1}
else echo -n $1
fi ; }
#-------------------------------------------------------------------------------
# source /etc/swiqlisp.rc & $SYSUSR_HOME/swiqlisp-utils
if test -r /etc/swiqlisp.rc; then
source /etc/swiqlisp.rc
else
echo "Error: /etc/swiqlisp.rc not found. Aborting."
exit 1
fi
# remove trailing slash in SYSUSR_HOME (if any)
SYSUSR_HOME=$(ensure_no_trailing_slash $SYSUSR_HOME)
if test -r $SYSUSR_HOME/swiqlisp-utils; then
source $SYSUSR_HOME/swiqlisp-utils
else
echo "Error: $SYSUSR_HOME/swiqlisp-utils not found. Aborting."
exit 1
fi
# debugging
if test $DEBUG = on; then
echo "debug: SYSUSR=$SYSUSR"
echo "debug: SYSUSR_HOME=$SYSUSR_HOME";
fi;
#-------------------------------------------------------------------------------
# check command line args, root privs, & SYSUSR
check_help $1 "Usage: sudo ./swiqlisp-uninstall"
check_root_privileges
check_lisp_and_setup_accordingly # needed for value of SYSINIT_FILE
if test -z "$(id -u $SYSUSR 2>/dev/null)"; then
# no SYSUSR
echo "SYSUSR ($SYSUSR) does not exist.
If you are certain that swiQlisp is installed, the most likely explanation is
that the value of SYSUSR has changed. Please check ./swiqlisp.rc."
exit 1;
fi
#-------------------------------------------------------------------------------
# get confirmation before proceeding
y-or-n-with-default-answer "Uninstall site-wide Quicklisp? Confirm" n
if test "$ans" = "y" -o "$ans" = "Y"; then
rm -f /etc/swiqlisp.rc /usr/bin/swiqlisp /usr/bin/swiqlisp-uninstall
userdel --remove $SYSUSR
sleep 1
echo "Sytem user $SYSUSR with home directory $SYSUSR_HOME removed."
echo "swiQlisp successfully uninstalled."
add_remove_swiqlisp_stanza
else
echo "Uninstallation operation aborted."
fi
# Local Variables:
# page-delimiter: "^#[=-]+$"
# End: