Add uninstall confirm dialog

This commit is contained in:
Teddysun 2014-05-30 10:15:37 +08:00
parent 3eab56d528
commit 3f446c9b94

View File

@ -163,25 +163,32 @@ function install(){
# Uninstall Shadowsocks-libev # Uninstall Shadowsocks-libev
function uninstall_shadowsocks_libev(){ function uninstall_shadowsocks_libev(){
NODE_PID=`ps -ef | grep -v grep | grep -v ps | grep -i '/usr/local/bin/ss-server' | awk '{print $2}'` printf "Are you sure uninstall Shadowsocks-libev? (y/n) : "
if [ ! -z $NODE_PID ]; then read answer
for pid in $NODE_PID printf "\n"
do if [ "$answer" = "y" ]; then
kill -9 $pid NODE_PID=`ps -ef | grep -v grep | grep -v ps | grep -i '/usr/local/bin/ss-server' | awk '{print $2}'`
if [ $? -eq 0 ]; then if [ ! -z $NODE_PID ]; then
echo "Shadowsocks-libev process[$pid] has been killed" for pid in $NODE_PID
fi do
done kill -9 $pid
if [ $? -eq 0 ]; then
echo "Shadowsocks-libev process[$pid] has been killed"
fi
done
fi
# delete config file
rm -f /etc/shadowsocks/config.json
# delete shadowsocks
rm -f /usr/local/bin/ss-local
rm -f /usr/local/bin/ss-tunnel
rm -f /usr/local/bin/ss-server
rm -f /usr/local/bin/ss-redir
rm -f /usr/local/share/man/man8/shadowsocks.8
echo "Shadowsocks-libev uninstall success!"
else
echo "uninstall cancelled, Nothing to do"
fi fi
# delete config file
rm -f /etc/shadowsocks/config.json
# delete shadowsocks
rm -f /usr/local/bin/ss-local
rm -f /usr/local/bin/ss-tunnel
rm -f /usr/local/bin/ss-server
rm -f /usr/local/bin/ss-redir
rm -f /usr/local/share/man/man8/shadowsocks.8
echo "Shadowsocks-libev uninstall success!"
} }
# Initialization step # Initialization step