mirror of https://github.com/tteck/Proxmox.git
Compare commits
3 Commits
aee12a7ede
...
13ae767e7f
Author | SHA1 | Date |
---|---|---|
|
13ae767e7f | |
|
6312591e58 | |
|
e72c28c324 |
|
@ -247,28 +247,52 @@ advanced_settings() {
|
|||
exit-script
|
||||
fi
|
||||
|
||||
if NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3); then
|
||||
if [ -z $NET ]; then
|
||||
NET="dhcp"
|
||||
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||
while true; do
|
||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address (/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3)
|
||||
exit_status=$?
|
||||
if [ $exit_status -eq 0 ]; then
|
||||
if [ "$NET" = "dhcp" ]; then
|
||||
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||
break
|
||||
else
|
||||
if [[ "$NET" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[1-2][0-9]|3[0-2])$ ]]; then
|
||||
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||
break
|
||||
else
|
||||
whiptail --msgbox "$NET is an invalid IPv4 CIDR address. Please enter a valid IPv4 CIDR address or 'dhcp'" 8 58
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||
exit-script
|
||||
fi
|
||||
else
|
||||
exit-script
|
||||
fi
|
||||
done
|
||||
|
||||
if GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3); then
|
||||
if [ -z $GATE1 ]; then
|
||||
GATE1="Default"
|
||||
GATE=""
|
||||
while true; do
|
||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3)
|
||||
exit_status=$?
|
||||
if [ $exit_status -eq 0 ]; then
|
||||
if [ -z "$GATE1" ]; then
|
||||
if [ "$NET" = "dhcp" ]; then
|
||||
GATE1="Default"
|
||||
GATE=""
|
||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||
break
|
||||
else
|
||||
whiptail --msgbox "Since a static IP was used, a gateway IP address is mandatory." 8 58
|
||||
fi
|
||||
else
|
||||
if [[ "$GATE1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
|
||||
GATE=",gw=$GATE1"
|
||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||
break
|
||||
else
|
||||
whiptail --msgbox "Invalid IP address. Please enter a valid IP address." 8 58
|
||||
fi
|
||||
fi
|
||||
else
|
||||
GATE=",gw=$GATE1"
|
||||
exit-script
|
||||
fi
|
||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||
else
|
||||
exit-script
|
||||
fi
|
||||
done
|
||||
|
||||
if (whiptail --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then
|
||||
DISABLEIP6="yes"
|
||||
|
@ -376,7 +400,7 @@ install_script() {
|
|||
arch_check
|
||||
pve_check
|
||||
if systemctl is-active -q ping-instances.service; then
|
||||
systemctl stop ping-instances.service
|
||||
systemctl stop ping-instances.service
|
||||
fi
|
||||
NEXTID=$(pvesh get /cluster/nextid)
|
||||
timezone=$(cat /etc/timezone)
|
||||
|
@ -512,6 +536,6 @@ description() {
|
|||
### https://tteck.github.io/Proxmox/
|
||||
<a href='https://ko-fi.com/D1D7EP4GF'><img src='https://img.shields.io/badge/☕-Buy me a coffee-red' /></a>"
|
||||
if [[ -f /etc/systemd/system/ping-instances.service ]]; then
|
||||
systemctl start ping-instances.service
|
||||
systemctl start ping-instances.service
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -118,11 +118,24 @@ remove() {
|
|||
echo "Removed Monitor All from Proxmox VE"
|
||||
}
|
||||
|
||||
if [ "$1" == "add" ]; then
|
||||
# Define options for the whiptail menu
|
||||
OPTIONS=(Add "Add Monitor-All to Proxmox VE" \
|
||||
Remove "Remove Monitor-All from Proxmox VE")
|
||||
|
||||
# Show the whiptail menu and save the user's choice
|
||||
CHOICE=$(whiptail --title "Monitor-All for Proxmox VE" --menu "Select an option:" 10 58 2 \
|
||||
"${OPTIONS[@]}" 3>&1 1>&2 2>&3)
|
||||
|
||||
# Check the user's choice and perform the corresponding action
|
||||
case $CHOICE in
|
||||
"Add")
|
||||
add
|
||||
elif [ "$1" == "remove" ]; then
|
||||
;;
|
||||
"Remove")
|
||||
remove
|
||||
else
|
||||
echo "Usage: $0 [ -s add | -s remove ]"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Exiting..."
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue