This commit is contained in:
CanbiZ 2025-05-16 09:05:27 +02:00
commit 971c902f3e

View File

@ -46,11 +46,9 @@ error_handler() {
if [[ -n "$CT_ID" ]]; then if [[ -n "$CT_ID" ]]; then
read -p "Remove this Container? <y/N> " prompt read -p "Remove this Container? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
pct stop "$CTID" &> /dev/null pct stop "$CT_ID" &> /dev/null
pct destroy "$CTID" &> /dev/null pct destroy "$CT_ID" &> /dev/null
msg_ok "Removed this Container" msg_ok "Removed this Container"
else
msg_warn "Did not remove this Container"
fi fi
fi fi
} }
@ -322,6 +320,7 @@ EOF
else else
echo -e "${INFO}${BOLD}${RD}Configuration file already exists at ${FILEPATH}${CL}" echo -e "${INFO}${BOLD}${RD}Configuration file already exists at ${FILEPATH}${CL}"
if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "Overwrite configfile" --yesno "Do you want to overwrite the existing config file?" 10 60; then if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "Overwrite configfile" --yesno "Do you want to overwrite the existing config file?" 10 60; then
rm -f "$FILEPATH"
cat <<EOF >"$FILEPATH" cat <<EOF >"$FILEPATH"
# ${NSAPP} Configuration File # ${NSAPP} Configuration File
# Generated on $(date) # Generated on $(date)
@ -490,12 +489,10 @@ advanced_settings() {
BRIDGES="" BRIDGES=""
OLD_IFS=$IFS OLD_IFS=$IFS
IFS=$'\n' IFS=$'\n'
echo $IFACE_FILEPATH_LIST
for iface_filepath in ${IFACE_FILEPATH_LIST}; do for iface_filepath in ${IFACE_FILEPATH_LIST}; do
echo -e "${INFO}${BOLD}${GN}Searching for bridges in ${iface_filepath}${CL}"
iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX') iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX')
( grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1 ) | awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' > "${iface_indexes_tmpfile}" ( grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1 ) | awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' > "${iface_indexes_tmpfile}" || true
if [ -f "${iface_indexes_tmpfile}" ]; then if [ -f "${iface_indexes_tmpfile}" ]; then
@ -912,7 +909,7 @@ config_file() {
for iface_filepath in ${IFACE_FILEPATH_LIST}; do for iface_filepath in ${IFACE_FILEPATH_LIST}; do
iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX') iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX')
( grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1 ) | awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' > "${iface_indexes_tmpfile}" ( grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1 ) | awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' > "${iface_indexes_tmpfile}" || true
if [ -f "${iface_indexes_tmpfile}" ]; then if [ -f "${iface_indexes_tmpfile}" ]; then