Add TAB3 formatting var to core (#4496)

This commit is contained in:
Slaviša Arežina 2025-05-15 10:31:37 +02:00 committed by GitHub
parent 369265a6d5
commit 19cf4d3dc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 23 deletions

View File

@ -17,6 +17,7 @@ color() {
BFR="\\r\\033[K" BFR="\\r\\033[K"
BOLD=$(echo "\033[1m") BOLD=$(echo "\033[1m")
TAB=" " TAB=" "
TAB3=" "
# System # System
RETRY_NUM=10 RETRY_NUM=10

View File

@ -32,6 +32,7 @@ color() {
BOLD=$(echo "\033[1m") BOLD=$(echo "\033[1m")
HOLD=" " HOLD=" "
TAB=" " TAB=" "
TAB3=" "
# Icons # Icons
CM="${TAB}✔️${TAB}" CM="${TAB}✔️${TAB}"
@ -528,29 +529,29 @@ advanced_settings() {
exit_script exit_script
fi fi
BRIDGES="" BRIDGES=""
IFACE_FILEPATH_LIST="/etc/network/interfaces"$'\n'$(find "/etc/network/interfaces.d/" -type f) IFACE_FILEPATH_LIST="/etc/network/interfaces"$'\n'$(find "/etc/network/interfaces.d/" -type f)
OLD_IFS=$IFS; IFS=$'\n' OLD_IFS=$IFS
IFS=$'\n'
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 ) | \ (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}" awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' >"${iface_indexes_tmpfile}"
if [ -f "${iface_indexes_tmpfile}" ]; then if [ -f "${iface_indexes_tmpfile}" ]; then
while read -r pair; do while read -r pair; do
start=$(echo "${pair}" | cut -d':' -f1) start=$(echo "${pair}" | cut -d':' -f1)
end=$(echo "${pair}" | cut -d':' -f2) end=$(echo "${pair}" | cut -d':' -f2)
if awk "NR >= ${start} && NR <= ${end}" "${iface_filepath}" | grep -qP '^\s*bridge[-_](ports|stp|fd|vlan-aware|vids)\s+'; then if awk "NR >= ${start} && NR <= ${end}" "${iface_filepath}" | grep -qP '^\s*bridge[-_](ports|stp|fd|vlan-aware|vids)\s+'; then
iface_name=$(sed "${start}q;d" "${iface_filepath}" | awk '{print $2}') iface_name=$(sed "${start}q;d" "${iface_filepath}" | awk '{print $2}')
BRIDGES="${iface_name}"$'\n'"${BRIDGES}" BRIDGES="${iface_name}"$'\n'"${BRIDGES}"
fi fi
done < "${iface_indexes_tmpfile}" done <"${iface_indexes_tmpfile}"
rm -f "${iface_indexes_tmpfile}" rm -f "${iface_indexes_tmpfile}"
fi fi
done done
@ -564,11 +565,11 @@ advanced_settings() {
echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
else else
BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --menu "Select network bridge:" 15 40 6 $(echo "$BRIDGES" | awk '{print $0, "Bridge"}') 3>&1 1>&2 2>&3) BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --menu "Select network bridge:" 15 40 6 $(echo "$BRIDGES" | awk '{print $0, "Bridge"}') 3>&1 1>&2 2>&3)
if [ -z "$BRG" ]; then if [ -z "$BRG" ]; then
exit_script exit_script
else else
echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
fi fi
fi fi
while true; do while true; do
@ -963,18 +964,17 @@ config_file() {
else else
msg_error "Invalid IP Address format for Gateway. Needs to be 0.0.0.0, was ${GATE}" msg_error "Invalid IP Address format for Gateway. Needs to be 0.0.0.0, was ${GATE}"
exit exit
fi
else
msg_error "Gateway IP Address cannot be empty"
exit
fi fi
else
msg_error "Gateway IP Address cannot be empty"
exit
fi
else else
msg_error "Invalid IP Address format. Needs to be 0.0.0.0/0, was ${NET}" msg_error "Invalid IP Address format. Needs to be 0.0.0.0/0, was ${NET}"
exit exit
fi fi
fi fi
if [[ ! -z "$APT_CACHER_IP" ]]; then if [[ ! -z "$APT_CACHER_IP" ]]; then
if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then
APT_CACHER="yes" APT_CACHER="yes"

View File

@ -19,6 +19,7 @@ color() {
BOLD=$(echo "\033[1m") BOLD=$(echo "\033[1m")
HOLD=" " HOLD=" "
TAB=" " TAB=" "
TAB3=" "
# System # System
RETRY_NUM=10 RETRY_NUM=10