Add updatescripts.sh
This commit is contained in:
65
updatescripts.sh
Normal file
65
updatescripts.sh
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
NF="\e[0m"
|
||||||
|
FB="\e[1m"
|
||||||
|
CG="\e[38;5;40m"
|
||||||
|
CR="\e[38;5;9m"
|
||||||
|
CY="\033[38;5;226m"
|
||||||
|
USER=$(getent passwd 1000 | cut -d: -f1)
|
||||||
|
PC=$(uname -n | awk '{print $1}')
|
||||||
|
|
||||||
|
if [ "$UID" -ne 0 ]; then
|
||||||
|
echo -e "${CR}This script must be run as root.${NF}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
guardband() {
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "${CR}Script Exited with an Error.${NF}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
verifygit(){
|
||||||
|
SRV="https://git.franscorack.com"
|
||||||
|
echo -e "${CY}Verifying Server availability...${NF}"
|
||||||
|
if ! wget --spider "$SRV" 2>/dev/null; then
|
||||||
|
echo -e "${CR}Error: Cannot reach Server - ${FB}Are you connected on the Internet ? / Is the Server down ?${NF}"
|
||||||
|
echo -e "${CR}Scripts can only be updated if $SRV is reachable. Script Halted. ${NF}"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo -e "${CG}Server available - ${FB}Proceeding...${NF}"
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
verifyprov(){
|
||||||
|
echo -e "${CY}Verifying Server availability...${NF}"
|
||||||
|
if ! wget --spider "https://$prov/" 2>/dev/null; then
|
||||||
|
echo -e "${CR}Error: Cannot reach Server - ${FB}Are you connected on the Internet ? / Is the Server down ?${NF}"
|
||||||
|
echo -e "${CR}Scripts can only be updated if $prov is reachable. Script Halted. ${NF}"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo -e "${CG}Server available - ${FB}Proceeding...${NF}"
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
updatescripts(){
|
||||||
|
if [ ! -d /.SSH/script ]; then
|
||||||
|
mkdir /.SSH/script
|
||||||
|
fi
|
||||||
|
find /.SSH/script -name "*.sh" -delete
|
||||||
|
wget -q https://git.franscorack.com/Franscobec/AutoremakeSSH/raw/branch/main/renewkeys.sh -O /.SSH/script/renewkeys.sh
|
||||||
|
wget -q https://git.franscorack.com/Franscobec/AutoremakeSSH/raw/branch/main/deploy-newssh.sh -O /.SSH/script/deploy-newssh.sh
|
||||||
|
wget -q https://git.franscorack.com/Franscobec/AutoremakeSSH/raw/branch/main/autoremakekeys.sh -O /.SSH/script/autoremakekeys.sh
|
||||||
|
wget -q https://git.franscorack.com/Franscobec/Server-Scripts/raw/branch/main/deploy-urbackup.sh -O /.SSH/script/deploy-urbackup.sh
|
||||||
|
wget -q https://git.franscorack.com/Franscobec/AutoremakeSSH/raw/branch/main/updatescripts.sh -O /.SSH/script/updatescripts.sh
|
||||||
|
wget -q https://$prov/script/upddockerimg.sh -O /opt/franscorack/script/upddockerimg.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
verifygit
|
||||||
|
guardband
|
||||||
|
verifyprov
|
||||||
|
guardband
|
||||||
|
updatescripts
|
||||||
|
guardband
|
||||||
Reference in New Issue
Block a user