update json

This commit is contained in:
Rögl-Brunner Michel 2025-02-06 16:35:39 +01:00
parent 28b7218b68
commit 76e3ed0148

View File

@ -4,7 +4,7 @@
# Author: michelroegl-brunner # Author: michelroegl-brunner
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<< $(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) source /dev/stdin <<<$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
function header_info { function header_info {
clear clear
@ -64,7 +64,7 @@ function cleanup_vmid() {
function cleanup() { function cleanup() {
popd >/dev/null popd >/dev/null
post_update_to_api "done" "none" post_update_to_api "done" "none"
rm -rf $TEMP_DIR rm -rf $TEMP_DIR
} }
@ -171,7 +171,7 @@ function pve_check() {
echo -e "Exiting..." echo -e "Exiting..."
sleep 2 sleep 2
exit exit
fi fi
} }
function arch_check() { function arch_check() {
@ -348,14 +348,14 @@ function advanced_settings() {
fi fi
echo -e "${DGN}Using LAN IP ADDRESS: ${BGN}$IP_ADDR${CL}" echo -e "${DGN}Using LAN IP ADDRESS: ${BGN}$IP_ADDR${CL}"
if LAN_GW=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a LAN GATEWAY IP" 8 58 $LAN_GW --title "LAN GATEWAY IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if LAN_GW=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a LAN GATEWAY IP" 8 58 $LAN_GW --title "LAN GATEWAY IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
if [ -z $LAN_GW ]; then if [ -z $LAN_GW ]; then
echo -e "${DGN}Gateway needs to be set if ip is not dhcp${CL}" echo -e "${DGN}Gateway needs to be set if ip is not dhcp${CL}"
exit-script
fi
echo -e "${DGN}Using LAN GATEWAY ADDRESS: ${BGN}$LAN_GW${CL}"
else
exit-script exit-script
fi fi
echo -e "${DGN}Using LAN GATEWAY ADDRESS: ${BGN}$LAN_GW${CL}"
else
exit-script
fi
else else
exit-script exit-script
fi fi
@ -383,14 +383,14 @@ function advanced_settings() {
fi fi
echo -e "${DGN}Using WAN IP ADDRESS: ${BGN}$WAN_IP_ADDR${CL}" echo -e "${DGN}Using WAN IP ADDRESS: ${BGN}$WAN_IP_ADDR${CL}"
if WAN_GW=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a WAN GATEWAY IP" 8 58 $WAN_GW --title "WAN GATEWAY IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if WAN_GW=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a WAN GATEWAY IP" 8 58 $WAN_GW --title "WAN GATEWAY IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
if [ -z $WAN_GW ]; then if [ -z $WAN_GW ]; then
echo -e "${DGN}Gateway needs to be set if ip is not dhcp${CL}" echo -e "${DGN}Gateway needs to be set if ip is not dhcp${CL}"
exit-script
fi
echo -e "${DGN}Using WAN GATEWAY ADDRESS: ${BGN}$WAN_GW${CL}"
else
exit-script exit-script
fi fi
echo -e "${DGN}Using WAN GATEWAY ADDRESS: ${BGN}$WAN_GW${CL}"
else
exit-script
fi
else else
exit-script exit-script
fi fi
@ -437,13 +437,6 @@ function advanced_settings() {
# exit-script # exit-script
#fi #fi
if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then
START_VM="yes"
else
START_VM="no"
fi
echo -e "${DGN}Start VM when completed: ${BGN}$START_VM${CL}"
if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create OpenSense VM?" --no-button Do-Over 10 58); then if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create OpenSense VM?" --no-button Do-Over 10 58); then
echo -e "${RD}Creating a OpenSense VM using the above advanced settings${CL}" echo -e "${RD}Creating a OpenSense VM using the above advanced settings${CL}"
else else
@ -506,7 +499,7 @@ msg_ok "${CL}${BL}${URL}${CL}"
wget -q --show-progress $URL wget -q --show-progress $URL
echo -en "\e[1A\e[0K" echo -en "\e[1A\e[0K"
FILE=Fressbsd.qcow2 FILE=Fressbsd.qcow2
unxz -cv $(basename $URL) > ${FILE} unxz -cv $(basename $URL) >${FILE}
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}" msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
@ -540,10 +533,11 @@ qm set $VMID \
-efidisk0 ${DISK0_REF}${FORMAT} \ -efidisk0 ${DISK0_REF}${FORMAT} \
-scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \ -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \
-boot order=scsi0 \ -boot order=scsi0 \
-serial0 socket >/dev/null \ -serial0 socket \
-tags community-scripts -tags community-scripts >/dev/null
qm resize $VMID scsi0 10G >/dev/null qm resize $VMID scsi0 10G >/dev/null
DESCRIPTION=$(cat <<EOF DESCRIPTION=$(
cat <<EOF
<div align='center'> <div align='center'>
<a href='https://Helper-Scripts.com' target='_blank' rel='noopener noreferrer'> <a href='https://Helper-Scripts.com' target='_blank' rel='noopener noreferrer'>
<img src='https://raw.githubusercontent.com/michelroegl-brunner/ProxmoxVE/refs/heads/develop/misc/images/logo-81x112.png' alt='Logo' style='width:81px;height:112px;'/> <img src='https://raw.githubusercontent.com/michelroegl-brunner/ProxmoxVE/refs/heads/develop/misc/images/logo-81x112.png' alt='Logo' style='width:81px;height:112px;'/>
@ -572,80 +566,77 @@ qm resize $VMID scsi0 10G >/dev/null
</div> </div>
EOF EOF
) )
qm set "$VMID" -description "$DESCRIPTION" >/dev/null qm set "$VMID" -description "$DESCRIPTION" >/dev/null
msg_info "Bridge interfaces are being added." msg_info "Bridge interfaces are being added."
qm set $VMID \ qm set $VMID \
-net0 virtio,bridge=${BRG},macaddr=${MAC}${VLAN}${MTU} 2>/dev/null -net0 virtio,bridge=${BRG},macaddr=${MAC}${VLAN}${MTU} 2>/dev/null
msg_ok "Bridge interfaces have been successfully added." msg_ok "Bridge interfaces have been successfully added."
msg_ok "Created a OpenSense VM ${CL}${BL}(${HN})" msg_ok "Created a OpenSense VM ${CL}${BL}(${HN})"
if [ "$START_VM" == "yes" ]; then
msg_ok "Starting OpenSense VM (Patience this takes 20-30 minutes)"
qm start $VMID
sleep 90
send_line_to_vm "root"
send_line_to_vm "fetch https://raw.githubusercontent.com/opnsense/update/master/src/bootstrap/opnsense-bootstrap.sh.in"
qm set $VMID \
-net1 virtio,bridge=${WAN_BRG},macaddr=${WAN_MAC} 2>/dev/null
sleep 10
send_line_to_vm "sh ./opnsense-bootstrap.sh.in -y -f -r ${RELEASE}"
#We need to wait for the OpenSense build proccess to finish, this takes a few minutes
sleep 1000
send_line_to_vm "root"
send_line_to_vm "opnsense"
send_line_to_vm "2"
if [ "$IP_ADDR" != "" ]; then msg_ok "Starting OpenSense VM (Patience this takes 20-30 minutes)"
send_line_to_vm "1" qm start $VMID
send_line_to_vm "n" sleep 90
send_line_to_vm "${IP_ADDR}" send_line_to_vm "root"
send_line_to_vm "${NETMASK}" send_line_to_vm "fetch https://raw.githubusercontent.com/opnsense/update/master/src/bootstrap/opnsense-bootstrap.sh.in"
send_line_to_vm "${LAN_GW}" qm set $VMID \
send_line_to_vm "n" -net1 virtio,bridge=${WAN_BRG},macaddr=${WAN_MAC} 2>/dev/null
send_line_to_vm " " sleep 10
send_line_to_vm "n" send_line_to_vm "sh ./opnsense-bootstrap.sh.in -y -f -r ${RELEASE}"
send_line_to_vm "n" #We need to wait for the OpenSense build proccess to finish, this takes a few minutes
send_line_to_vm " " sleep 1000
send_line_to_vm "n" send_line_to_vm "root"
send_line_to_vm "n" send_line_to_vm "opnsense"
send_line_to_vm "n" send_line_to_vm "2"
send_line_to_vm "n"
send_line_to_vm "n"
else
send_line_to_vm "1"
send_line_to_vm "y"
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm "n"
fi
#we need to wait for the Config changes to be saved
sleep 20
if [ "$WAN_IP_ADDR" != "" ]; then
send_line_to_vm "2"
send_line_to_vm "2"
send_line_to_vm "n"
send_line_to_vm "${WAN_IP_ADDR}"
send_line_to_vm "${NETMASK}"
send_line_to_vm "${LAN_GW}"
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm "n"
fi
sleep 10
send_line_to_vm "0"
msg_ok "Started OpenSense VM"
if [ "$IP_ADDR" != "" ]; then
send_line_to_vm "1"
send_line_to_vm "n"
send_line_to_vm "${IP_ADDR}"
send_line_to_vm "${NETMASK}"
send_line_to_vm "${LAN_GW}"
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm "n"
else
send_line_to_vm "1"
send_line_to_vm "y"
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm "n"
fi fi
#we need to wait for the Config changes to be saved
sleep 20
if [ "$WAN_IP_ADDR" != "" ]; then
send_line_to_vm "2"
send_line_to_vm "2"
send_line_to_vm "n"
send_line_to_vm "${WAN_IP_ADDR}"
send_line_to_vm "${NETMASK}"
send_line_to_vm "${LAN_GW}"
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm " "
send_line_to_vm "n"
send_line_to_vm "n"
send_line_to_vm "n"
fi
sleep 10
send_line_to_vm "0"
msg_ok "Started OpenSense VM"
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
if [ "$IP_ADDR" != "" ]; then if [ "$IP_ADDR" != "" ]; then
echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}"