Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-uninstall.sh 2454 2017-12-09 18:59:31Z tom.houdayer $
|
2 |
# $Id: alcasar-uninstall.sh 2457 2017-12-10 14:11:01Z richard $
|
3 |
|
3 |
|
4 |
# alcasar-uninstall.sh
|
4 |
# alcasar-uninstall.sh
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
|
7 |
|
Line 75... |
Line 75... |
75 |
killall $i
|
75 |
killall $i
|
76 |
fi
|
76 |
fi
|
77 |
done
|
77 |
done
|
78 |
if [ $mode == "update" ] # reload sshd in case of remote update
|
78 |
if [ $mode == "update" ] # reload sshd in case of remote update
|
79 |
then
|
79 |
then
|
80 |
systemctl reload sshd
|
80 |
/usr/bin/systemctl reload sshd
|
81 |
fi
|
81 |
fi
|
82 |
echo "Reset ALCASAR main functions : "
|
82 |
echo "Reset ALCASAR main functions : "
|
83 |
echo -en "\n- init (1) : "
|
83 |
echo -en "\n- init (1) : "
|
84 |
# The files in /usr/local/ will be removed at the end (usefull here)
|
84 |
# The files in /usr/local/ will be removed at the end (usefull here)
|
85 |
rm -f /root/ALCASAR* && echo -n "1"
|
85 |
rm -f /root/ALCASAR* && echo -n "1"
|
Line 278... |
Line 278... |
278 |
[ -e /etc/hosts.allow.default ] && mv -f /etc/hosts.allow.default /etc/hosts.allow && echo -n "5, "
|
278 |
[ -e /etc/hosts.allow.default ] && mv -f /etc/hosts.allow.default /etc/hosts.allow && echo -n "5, "
|
279 |
[ -e /etc/hosts.deny.default ] && mv -f /etc/hosts.deny.default /etc/hosts.deny && echo -n "6, "
|
279 |
[ -e /etc/hosts.deny.default ] && mv -f /etc/hosts.deny.default /etc/hosts.deny && echo -n "6, "
|
280 |
[ -e /etc/modprobe.preload.default ] && mv -f /etc/modprobe.preload.default /etc/modprobe.preload && echo -n "7, "
|
280 |
[ -e /etc/modprobe.preload.default ] && mv -f /etc/modprobe.preload.default /etc/modprobe.preload && echo -n "7, "
|
281 |
[ -e /lib/systemd/system/iptables.service.default ] && mv -f /lib/systemd/system/iptables.service.default /lib/systemd/system/iptables.service && echo -n "8, "
|
281 |
[ -e /lib/systemd/system/iptables.service.default ] && mv -f /lib/systemd/system/iptables.service.default /lib/systemd/system/iptables.service && echo -n "8, "
|
282 |
[ -e /usr/libexec/iptables.init.default ] && mv -f /usr/libexec/iptables.init.default /usr/libexec/iptables.init && echo -n "9"
|
282 |
[ -e /usr/libexec/iptables.init.default ] && mv -f /usr/libexec/iptables.init.default /usr/libexec/iptables.init && echo -n "9"
|
283 |
/sbin/ifup $EXTIF
|
283 |
/usr/bin/systemctl restart network
|
284 |
sleep 1
|
284 |
sleep 1
|
285 |
fi
|
285 |
fi
|
286 |
|
286 |
|
287 |
#post_install
|
287 |
#post_install
|
288 |
echo -en "\n- post_install (7) : "
|
288 |
echo -en "\n- post_install (7) : "
|
Line 291... |
Line 291... |
291 |
[ -e /etc/ssh/sshd_config.default ] && mv -f /etc/ssh/sshd_config.default /etc/ssh/sshd_config && echo -n "3, "
|
291 |
[ -e /etc/ssh/sshd_config.default ] && mv -f /etc/ssh/sshd_config.default /etc/ssh/sshd_config && echo -n "3, "
|
292 |
[ -e /etc/bashrc.default ] && mv -f /etc/bashrc.default /etc/bashrc && echo -n "4, "
|
292 |
[ -e /etc/bashrc.default ] && mv -f /etc/bashrc.default /etc/bashrc && echo -n "4, "
|
293 |
[ -e /etc/sudoers.default ] && mv -f /etc/sudoers.default /etc/sudoers && echo -n "5, "
|
293 |
[ -e /etc/sudoers.default ] && mv -f /etc/sudoers.default /etc/sudoers && echo -n "5, "
|
294 |
[ -e /lib/systemd/system/alcasar-load_balancing.service ] && rm -f /lib/systemd/system/alcasar-load_balancing.service && echo -n "6, "
|
294 |
[ -e /lib/systemd/system/alcasar-load_balancing.service ] && rm -f /lib/systemd/system/alcasar-load_balancing.service && echo -n "6, "
|
295 |
[ -e /etc/default/grub.default ] && mv -f /etc/default/grub.default /etc/default/grub && echo -n "7"
|
295 |
[ -e /etc/default/grub.default ] && mv -f /etc/default/grub.default /etc/default/grub && echo -n "7"
|
296 |
/usr/bin/update-grub2
|
- |
|
297 |
sleep 1
|
296 |
sleep 1
|
298 |
|
297 |
|
299 |
# Cleaning (remove all "old" alcasar scripts)
|
298 |
# Cleaning (remove all "old" alcasar scripts)
|
300 |
echo -en "\n- End of cleaning ...\n"
|
299 |
echo -en "\n- End of cleaning ...\n"
|
301 |
for rm_fic in /usr/local/bin /usr/local/etc /usr/local/sbin
|
300 |
for rm_fic in /usr/local/bin /usr/local/etc /usr/local/sbin
|
302 |
do
|
301 |
do
|
303 |
rm -rf $rm_fic/alcasar*
|
302 |
rm -rf $rm_fic/alcasar*
|
304 |
done
|
303 |
done
|
- |
|
304 |
/usr/bin/update-grub2
|
- |
|
305 |
echo "Waiting for Network to be up again ..."
|
- |
|
306 |
i=0
|
- |
|
307 |
while [ $i -lt 10 ] # We wait 10 seconds max
|
- |
|
308 |
do
|
- |
|
309 |
DNS1=`grep ^nameserver /etc/resolv.conf|awk -F" " '{print $2}'|head -n 1`
|
- |
|
310 |
if [ "$DNS1" != "" ] && [ "$DNS1" != "127.0.0.1" ]
|
- |
|
311 |
then
|
- |
|
312 |
i=9
|
- |
|
313 |
fi
|
- |
|
314 |
i=`expr $i + 1`
|
- |
|
315 |
sleep 1
|
- |
|
316 |
done
|