Run this script only after confirmation, because changes are substantial.
This commit is contained in:
parent
52815b0f74
commit
8d71bf676c
@ -84,6 +84,22 @@ exit
|
||||
|
||||
}
|
||||
|
||||
fatal (){
|
||||
echo ""
|
||||
echo ""
|
||||
if $terminal ; then
|
||||
echo -e "\t[ \033[31m\033[1mFatal\033[m ]: \033[37m\033[1m$*\033[m"
|
||||
echo ""
|
||||
echo -e "\t\033[31m\033[1m Script will be interrupted..\033[m\033[m"
|
||||
else
|
||||
echo "fatal: $*"
|
||||
echo "Firewall Script will be interrupted.."
|
||||
fi
|
||||
echo ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
error(){
|
||||
echo ""
|
||||
if $terminal ; then
|
||||
@ -139,6 +155,12 @@ echo_SKIPPED() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# =============
|
||||
# ---
|
||||
# =============
|
||||
|
||||
|
||||
[ $# -ne "1" ] && usage "wrong number of arguments"
|
||||
|
||||
|
||||
@ -162,9 +184,45 @@ case $1 in
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
||||
clear
|
||||
echo ""
|
||||
echo "Configure gateway for network \"$network\".."
|
||||
echo ""
|
||||
echo -e "\t\033[1;32mChange basic Configuration of this machine to \033[1;37m$network \033[m"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
echo -e "Again: \033[1;37mrunning this script will change your system basically.\033[m"
|
||||
echo ""
|
||||
echo ""
|
||||
echo -n "Type upper case 'YES' to continue executing this script: "
|
||||
read OK
|
||||
if [[ "$OK" = "YES" ]] ; then
|
||||
echo ""
|
||||
echo ""
|
||||
echo -e "\t\033[1;32mConfigure This machine for running as Gateway/Server \033[1;37m$network \033[m"
|
||||
echo ""
|
||||
else
|
||||
fatal "Abort by user request - Answer as not 'YES'"
|
||||
fi
|
||||
|
||||
if [ "$(stat -c %d:%i /)" = "$(stat -c %d:%i /proc/1/root/.)" ]; then
|
||||
|
||||
if [[ -d "/ro" ]] ; then
|
||||
error "It seems, this is a readonly system and you are not chrooted.\n\n\t \033[1;37mChanges made by this script are not persistent!!\033[m\n\n\t Change root to directory '/ro' (\033[1;37mchroot /ro /bin/bash\033[m) and\n\t run this script again.\033[m"
|
||||
fi
|
||||
|
||||
|
||||
echo -n "Type upper case 'YES' for executing anyway: "
|
||||
read OK
|
||||
if [[ "$OK" != "YES" ]] ; then
|
||||
fatal "Abort by user request - Answer as not 'YES'"
|
||||
fi
|
||||
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
# - Nameserver Bind
|
||||
# - /etc/bind/*
|
||||
@ -755,14 +813,13 @@ else
|
||||
echo_OK
|
||||
fi
|
||||
|
||||
_error=false
|
||||
if [ "$(stat -c %d:%i /)" = "$(stat -c %d:%i /proc/1/root/.)" ]; then
|
||||
|
||||
if [[ -d "/ro" ]] ; then
|
||||
error "It seems, this is a readonly system and you are not chrooted.\n\n\t \033[1;37mChanges made by this script are not persistent!!\033[m\n\n\t Change root to directory '/ro' (\033[1;37mchroot /ro /bin/bash\033[m) and\n\t run this script again.\033[m"
|
||||
fi
|
||||
|
||||
_error=true
|
||||
warn "Again: this script was \033[1;37mnot\033[m running in a chrooted environment."
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
@ -770,7 +827,7 @@ else
|
||||
|
||||
fi
|
||||
|
||||
if $_add_support_if i&& ! $_error ; then
|
||||
if $_add_support_if ; then
|
||||
info "After restarting, you can reach this machine\n\t at ip-address: \033[1;33m172.16.1.1\033[m"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user