forked from mysecureshell/mysecureshell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstaller.sh.in
executable file
·125 lines (112 loc) · 2.68 KB
/
uninstaller.sh.in
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/sh
## Uninstaller Script v0.2 for MySecureShell made by Pierre
## MySecureShell Team <teka2nerdman@users.sourceforge.net>
## Language local initialising
BINDIR=@BINDIR@
MANDIR=@MANDIR@
USRBINDIR=@BINDIR@
ETCDIR=@ETCDIR@
LANG=
## Functions Looking for available languages
MyGetLocale()
{
if [ "$LANG" = "" ] ; then
echo $1
else
tmp=`grep -F "$1=" locales_$LANG | cut -d= -f2-`
if [ "$tmp" = "" ] ; then
echo $1
else
echo $tmp
fi
fi
}
MyListLocale()
{
echo "The available languages are:"
grep -F 'DESCRIPTION=' locales_* | cut -d= -f2-
echo "Usage: ./uninstall.sh xx(language)"
}
if [ "$1" = "" ] ; then
MyListLocale
exit 1
else
if [ -f "locales_$1" ] ; then
LANG=$1
fi
fi
clear
## Root detection
euid="`id -u`"
if [ "$euid" != "0" ] ; then
echo ""
echo "###################################################################"
tmp=`MyGetLocale 'sorry'`
echo " $tmp"
MyGetLocale 'Warning root ask'
echo "###################################################################"
echo ""
exit 1
fi
MyGetLocale 'uninst?'
read ans
test -z "$ans" && ans="n"
case "$ans" in
[yY])
rm -f $BINDIR/MySecureShell $BINDIR/sftp-who $BINDIR/sftp-state $BINDIR/sftp-kill $BINDIR/sftp-admin $BINDIR/sftp-user
cat /etc/shells | grep -v MySecureShell > /tmp/shells~
mv /tmp/shells~ /etc/shells
# Only for Mac OS X
if [ -d /Applications/MySecureShell ] ; then
rm -Rf /Applications/MySecureShell
else
break
fi
if [ -d /Library/Receipts ] ; then
rm -Rf /Library/Receipts/MySecureShell*
else
break
fi
# Delete mans
if [ -d $MANDIR/man8 ] ; then
rm -f $MANDIR/man8/MySecureShell.8
rm -f $MANDIR/man8/sftp-admin.8
rm -f $MANDIR/man8/sftp-kill.8
rm -f $MANDIR/man8/sftp-state.8
rm -f $MANDIR/man8/sftp-user.8
rm -f $MANDIR/man8/sftp-verif.8
rm -f $MANDIR/man8/sftp-who.8
fi
if [ -d $MANDIR/en/man8 ] ; then
rm -f $MANDIR/en/man8/MySecureShell.8
rm -f $MANDIR/en/man8/sftp-admin.8
rm -f $MANDIR/en/man8/sftp-kill.8
rm -f $MANDIR/en/man8/sftp-state.8
rm -f $MANDIR/en/man8/sftp-user.8
rm -f $MANDIR/en/man8/sftp-verif.8
rm -f $MANDIR/en/man8/sftp-who.8
fi
if [ -d $MANDIR/fr/man8 ] ; then
rm -f $MANDIR/fr/man8/MySecureShell.8
rm -f $MANDIR/fr/man8/sftp-admin.8
rm -f $MANDIR/fr/man8/sftp-kill.8
rm -f $MANDIR/fr/man8/sftp-state.8
rm -f $MANDIR/fr/man8/sftp-user.8
rm -f $MANDIR/fr/man8/sftp-verif.8
rm -f $MANDIR/fr/man8/sftp-who.8
fi
# Delete configuration ?
MyGetLocale 'delconf?'
read ans2
test -z "$ans2" && ans2="n"
case "$ans2" in
[yY])
rm -f $ETCDIR/ssh/sftp-config $ETCDIR/sshd/sftp-config
;;
esac
MyGetLocale 'mssuninstok!'
;;
*)
MyGetLocale 'mssuninstfail'
;;
esac