From 3871c620ba42e7d85c70f19b1ecaad800d2aed42 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Sun, 6 Jul 2025 22:26:57 +0200 Subject: [PATCH] Fix read and make it POSIX compliant --- ct/bytestash.sh | 2 +- ct/homarr.sh | 2 +- install/authelia-install.sh | 2 +- install/bytestash-install.sh | 2 +- install/cloudflare-ddns-install.sh | 8 ++++---- install/cryptpad-install.sh | 2 +- install/elementsynapse-install.sh | 2 +- install/kometa-install.sh | 6 +++--- install/komodo-install.sh | 2 +- install/minio-install.sh | 2 +- install/mongodb-install.sh | 2 +- install/navidrome-install.sh | 2 +- install/paperless-gpt-install.sh | 8 ++++---- install/pterodactyl-panel-install.sh | 6 +++--- tools/addon/add-netbird-lxc.sh | 2 +- tools/addon/add-tailscale-lxc.sh | 2 +- tools/addon/coder-code-server.sh | 2 +- tools/addon/crowdsec.sh | 2 +- tools/addon/glances.sh | 2 +- tools/addon/netdata.sh | 2 +- tools/addon/olivetin.sh | 2 +- ...ant-container-copy-data-home-assistant-container.sh | 2 +- ...ssistant-container-copy-data-home-assistant-core.sh | 2 +- ...istant-container-copy-data-podman-home-assistant.sh | 2 +- ...ssistant-core-copy-data-home-assistant-container.sh | 2 +- ...ome-assistant-core-copy-data-home-assistant-core.sh | 2 +- tools/copy-data/plex-copy-data-plex.sh | 2 +- ...ome-assistant-copy-data-home-assistant-container.sh | 2 +- tools/copy-data/z2m-copy-data-z2m.sh | 2 +- tools/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh | 2 +- tools/pve/add-iptag.sh | 6 +++--- tools/pve/clean-orphaned-lvm.sh | 2 +- tools/pve/container-restore-from-backup.sh | 2 +- tools/pve/core-restore-from-backup.sh | 2 +- tools/pve/cron-update-lxcs.sh | 2 +- tools/pve/frigate-support.sh | 2 +- tools/pve/host-backup.sh | 2 +- tools/pve/kernel-clean.sh | 2 +- tools/pve/lxc-delete.sh | 4 ++-- tools/pve/monitor-all.sh | 2 +- tools/pve/pbs3-upgrade.sh | 2 +- tools/pve/post-pbs-install.sh | 2 +- tools/pve/post-pmg-install.sh | 2 +- tools/pve/post-pve-install.sh | 2 +- tools/pve/pve-privilege-converter.sh | 10 +++++----- tools/pve/pve8-upgrade.sh | 2 +- tools/pve/usb-passthrough.sh | 2 +- 47 files changed, 64 insertions(+), 64 deletions(-) diff --git a/ct/bytestash.sh b/ct/bytestash.sh index bac7f28fcdb..1a454dffdf9 100644 --- a/ct/bytestash.sh +++ b/ct/bytestash.sh @@ -31,7 +31,7 @@ function update_script() { RELEASE=$(curl -fsSL https://api.github.com/repos/jordan-dalby/ByteStash/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') if [[ "${RELEASE}" != "$(cat ~/.bytestash 2>/dev/null)" ]] || [[ ! -f ~/.bytestash ]]; then - read -rp "${TAB3}Did you make a backup via application WebUI? (y/n): " backuped + read -r -p "${TAB3}Did you make a backup via application WebUI? (y/n): " backuped if [[ "$backuped" =~ ^[Yy]$ ]]; then msg_info "Stopping Services" systemctl stop bytestash-backend diff --git a/ct/homarr.sh b/ct/homarr.sh index e50ba4e6e62..27c99049137 100644 --- a/ct/homarr.sh +++ b/ct/homarr.sh @@ -160,7 +160,7 @@ EOF systemctl start homarr msg_ok "Started Services" msg_ok "Updated Successfully" - read -p "${TAB3}It's recommended to reboot the LXC after an update, would you like to reboot the LXC now ? (y/n): " choice + read -r -p "${TAB3}It's recommended to reboot the LXC after an update, would you like to reboot the LXC now ? (y/n): " choice if [[ "$choice" =~ ^[Yy]$ ]]; then reboot fi diff --git a/install/authelia-install.sh b/install/authelia-install.sh index d1e85048399..63162c89460 100644 --- a/install/authelia-install.sh +++ b/install/authelia-install.sh @@ -15,7 +15,7 @@ update_os fetch_and_deploy_gh_release "authelia" "authelia/authelia" "binary" -read -rp "${TAB3}Enter your domain (ex. example.com): " DOMAIN +read -r -p "${TAB3}Enter your domain (ex. example.com): " DOMAIN msg_info "Setting Authelia up" touch /etc/authelia/emails.txt diff --git a/install/bytestash-install.sh b/install/bytestash-install.sh index d6e4e393d4d..f659d3ec293 100644 --- a/install/bytestash-install.sh +++ b/install/bytestash-install.sh @@ -24,7 +24,7 @@ cd /opt/bytestash/client $STD npm install msg_ok "Installed ByteStash" -read -rp "${TAB3}Do you want to allow registration of multiple accounts? [y/n]: " allowreg +read -r -p "${TAB3}Do you want to allow registration of multiple accounts? [y/n]: " allowreg msg_info "Creating Service" cat </etc/systemd/system/bytestash-backend.service diff --git a/install/cloudflare-ddns-install.sh b/install/cloudflare-ddns-install.sh index 6f03a3352cc..3866db30b7a 100644 --- a/install/cloudflare-ddns-install.sh +++ b/install/cloudflare-ddns-install.sh @@ -16,14 +16,14 @@ update_os setup_go var_cf_api_token="default" -read -rp "${TAB3}Enter the Cloudflare API token: " var_cf_api_token +read -r -p "${TAB3}Enter the Cloudflare API token: " var_cf_api_token var_cf_domains="default" -read -rp "${TAB3}Enter the domains separated with a comma (*.example.org,www.example.org) " var_cf_domains +read -r -p "${TAB3}Enter the domains separated with a comma (*.example.org,www.example.org) " var_cf_domains var_cf_proxied="false" while true; do - read -rp "${TAB3}Proxied? (y/n): " answer + read -r -p "${TAB3}Proxied? (y/n): " answer case "$answer" in [Yy]*) var_cf_proxied="true" @@ -38,7 +38,7 @@ while true; do done var_cf_ip6_provider="none" while true; do - read -rp "${TAB3}Enable IPv6 support? (y/n): " answer + read -r -p "${TAB3}Enable IPv6 support? (y/n): " answer case "$answer" in [Yy]*) var_cf_ip6_provider="auto" diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index d7615a71b08..f96b17c7d88 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -19,7 +19,7 @@ msg_ok "Installed Dependencies" NODE_VERSION="22" setup_nodejs -read -rp "${TAB3}Install OnlyOffice components instead of CKEditor? (Y/N): " onlyoffice +read -r -p "${TAB3}Install OnlyOffice components instead of CKEditor? (Y/N): " onlyoffice fetch_and_deploy_gh_release "cryptpad" "cryptpad/cryptpad" msg_info "Setup ${APPLICATION}" diff --git a/install/elementsynapse-install.sh b/install/elementsynapse-install.sh index ec8d56b538e..3cde3f8dccd 100644 --- a/install/elementsynapse-install.sh +++ b/install/elementsynapse-install.sh @@ -22,7 +22,7 @@ msg_ok "Installed Dependencies" NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs -read -p "${TAB3}Please enter the name for your server: " servername +read -r -p "${TAB3}Please enter the name for your server: " servername msg_info "Installing Element Synapse" curl -fsSL "https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg" -o "/usr/share/keyrings/matrix-org-archive-keyring.gpg" diff --git a/install/kometa-install.sh b/install/kometa-install.sh index 8c9634188eb..830af5ac627 100644 --- a/install/kometa-install.sh +++ b/install/kometa-install.sh @@ -31,9 +31,9 @@ cp config/config.yml.template config/config.yml echo "${RELEASE}" >/opt/kometa_version.txt msg_ok "Setup Kometa" -read -p "${TAB3}nter your TMDb API key: " TMDBKEY -read -p "${TAB3}Enter your Plex URL: " PLEXURL -read -p "${TAB3}Enter your Plex token: " PLEXTOKEN +read -r -p "${TAB3}nter your TMDb API key: " TMDBKEY +read -r -p "${TAB3}Enter your Plex URL: " PLEXURL +read -r -p "${TAB3}Enter your Plex token: " PLEXTOKEN sed -i -e "s#url: http://192.168.1.12:32400#url: $PLEXURL #g" /opt/kometa/config/config.yml sed -i -e "s/token: ####################/token: $PLEXTOKEN/g" /opt/kometa/config/config.yml sed -i -e "s/apikey: ################################/apikey: $TMDBKEY/g" /opt/kometa/config/config.yml diff --git a/install/komodo-install.sh b/install/komodo-install.sh index 7717b281f34..b3c43112e7c 100644 --- a/install/komodo-install.sh +++ b/install/komodo-install.sh @@ -40,7 +40,7 @@ msg_ok "Installed Docker" echo "${TAB3}Choose the database for Komodo installation:" echo "${TAB3}1) MongoDB (recommended)" echo "${TAB3}2) FerretDB" -read -rp "${TAB3}Enter your choice (default: 1): " DB_CHOICE +read -r -p "${TAB3}Enter your choice (default: 1): " DB_CHOICE DB_CHOICE=${DB_CHOICE:-1} case $DB_CHOICE in diff --git a/install/minio-install.sh b/install/minio-install.sh index fe6bc6b47be..d178e7a2baa 100644 --- a/install/minio-install.sh +++ b/install/minio-install.sh @@ -24,7 +24,7 @@ echo "Choose which version to install:" echo " [N] Feature-rich community version ($FEATURE_RICH_VERSION) [Recommended]" echo " [Y] Latest version (may lack UI features)" echo -read -p "Install latest MinIO version? [y/N]: " -n 1 -r +read -r -p "Install latest MinIO version? [y/N]: " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then USE_LATEST=true diff --git a/install/mongodb-install.sh b/install/mongodb-install.sh index 94398616b25..34a9147df56 100644 --- a/install/mongodb-install.sh +++ b/install/mongodb-install.sh @@ -13,7 +13,7 @@ setting_up_container network_check update_os -read -p "${TAB3}Do you want to install MongoDB 8.0 instead of 7.0? [y/N]: " install_mongodb_8 +read -r -p "${TAB3}Do you want to install MongoDB 8.0 instead of 7.0? [y/N]: " install_mongodb_8 if [[ "$install_mongodb_8" =~ ^[Yy]$ ]]; then MONGODB_VERSION="8.0" else diff --git a/install/navidrome-install.sh b/install/navidrome-install.sh index 0d1fdc1671b..2cd644b1526 100644 --- a/install/navidrome-install.sh +++ b/install/navidrome-install.sh @@ -27,7 +27,7 @@ systemctl enable -q --now navidrome echo "${RELEASE}" >/opt/Navidrome_version.txt msg_ok "Installed Navidrome" -read -p "${TAB3}Do you want to install filebrowser addon? (y/n) " -n 1 -r +read -r -p "${TAB3}Do you want to install filebrowser addon? (y/n) " -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]]; then bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/filebrowser.sh)" fi diff --git a/install/paperless-gpt-install.sh b/install/paperless-gpt-install.sh index a4e02062b30..7c29b20b621 100644 --- a/install/paperless-gpt-install.sh +++ b/install/paperless-gpt-install.sh @@ -44,16 +44,16 @@ echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Setup Paperless-GPT" mkdir -p /opt/paperless-gpt-data -read -p "${TAB3}Do you want to enter the Paperless local URL now? (y/n) " input_url +read -r -p "${TAB3}Do you want to enter the Paperless local URL now? (y/n) " input_url if [[ "$input_url" =~ ^[Yy]$ ]]; then - read -p "${TAB3}Enter your Paperless-NGX instance URL (e.g., http://192.168.1.100:8000): " PAPERLESS_BASE_URL + read -r -p "${TAB3}Enter your Paperless-NGX instance URL (e.g., http://192.168.1.100:8000): " PAPERLESS_BASE_URL else PAPERLESS_BASE_URL="http://your_paperless_ngx_url" fi -read -p "${TAB3}Do you want to enter the Paperless API token now? (y/n) " input_token +read -r -p "${TAB3}Do you want to enter the Paperless API token now? (y/n) " input_token if [[ "$input_token" =~ ^[Yy]$ ]]; then - read -p "${TAB3}Enter your Paperless API token: " PAPERLESS_API_TOKEN + read -r -p "${TAB3}Enter your Paperless API token: " PAPERLESS_API_TOKEN else PAPERLESS_API_TOKEN="your_paperless_api_token" fi diff --git a/install/pterodactyl-panel-install.sh b/install/pterodactyl-panel-install.sh index 419fd67d929..f132463fc6e 100644 --- a/install/pterodactyl-panel-install.sh +++ b/install/pterodactyl-panel-install.sh @@ -53,9 +53,9 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS } >>~/pterodactyl-panel.creds msg_ok "Set up MariaDB" -read -p "${TAB3}Provide an email address for admin login, this should be a valid email address: " ADMIN_EMAIL -read -p "${TAB3}Enter your First Name: " NAME_FIRST -read -p "${TAB3}Enter your Last Name: " NAME_LAST +read -r -p "${TAB3}Provide an email address for admin login, this should be a valid email address: " ADMIN_EMAIL +read -r -p "${TAB3}Enter your First Name: " NAME_FIRST +read -r -p "${TAB3}Enter your Last Name: " NAME_LAST msg_info "Installing pterodactyl Panel" RELEASE=$(curl -fsSL https://api.github.com/repos/pterodactyl/panel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') diff --git a/tools/addon/add-netbird-lxc.sh b/tools/addon/add-netbird-lxc.sh index 0ca45f3ba9a..07f9430246d 100644 --- a/tools/addon/add-netbird-lxc.sh +++ b/tools/addon/add-netbird-lxc.sh @@ -20,7 +20,7 @@ EOF header_info set -e while true; do - read -p "This will add NetBird to an existing LXC Container ONLY. Proceed(y/n)?" yn + read -r -p "This will add NetBird to an existing LXC Container ONLY. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/addon/add-tailscale-lxc.sh b/tools/addon/add-tailscale-lxc.sh index 65db7ec0121..9bd2de7b92c 100644 --- a/tools/addon/add-tailscale-lxc.sh +++ b/tools/addon/add-tailscale-lxc.sh @@ -31,7 +31,7 @@ if ! command -v pveversion &>/dev/null; then fi while true; do - read -rp "This will add Tailscale to an existing LXC Container ONLY. Proceed (y/n)? " yn + read -r -p "This will add Tailscale to an existing LXC Container ONLY. Proceed (y/n)? " yn case "$yn" in [Yy]*) break ;; [Nn]*) exit 0 ;; diff --git a/tools/addon/coder-code-server.sh b/tools/addon/coder-code-server.sh index 5d155487685..38c03fbbe9f 100644 --- a/tools/addon/coder-code-server.sh +++ b/tools/addon/coder-code-server.sh @@ -55,7 +55,7 @@ if [ -e /etc/alpine-release ]; then exit fi while true; do - read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + read -r -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/addon/crowdsec.sh b/tools/addon/crowdsec.sh index e59eace0384..587a40ec019 100644 --- a/tools/addon/crowdsec.sh +++ b/tools/addon/crowdsec.sh @@ -38,7 +38,7 @@ if command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + read -r -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/addon/glances.sh b/tools/addon/glances.sh index 90012a9df5d..baea3ff9446 100644 --- a/tools/addon/glances.sh +++ b/tools/addon/glances.sh @@ -58,7 +58,7 @@ msg_ok() { install() { header_info while true; do - read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + read -r -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/addon/netdata.sh b/tools/addon/netdata.sh index 250b8f1c1f5..6af1fd90360 100644 --- a/tools/addon/netdata.sh +++ b/tools/addon/netdata.sh @@ -42,7 +42,7 @@ function msg_ok() { install() { header_info while true; do - read -p "Are you sure you want to install NetData on Proxmox VE host. Proceed(y/n)?" yn + read -r -p "Are you sure you want to install NetData on Proxmox VE host. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/addon/olivetin.sh b/tools/addon/olivetin.sh index 6caed156275..abcdcc2c7d6 100644 --- a/tools/addon/olivetin.sh +++ b/tools/addon/olivetin.sh @@ -31,7 +31,7 @@ set-e header_info while true; do - read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + read -r -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/home-assistant-container-copy-data-home-assistant-container.sh b/tools/copy-data/home-assistant-container-copy-data-home-assistant-container.sh index acf2b380a1a..69e1cd5dc45 100644 --- a/tools/copy-data/home-assistant-container-copy-data-home-assistant-container.sh +++ b/tools/copy-data/home-assistant-container-copy-data-home-assistant-container.sh @@ -13,7 +13,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from one Home Assistant LXC to another. Proceed(y/n)?" yn + read -r -p "Use to copy all data from one Home Assistant LXC to another. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/home-assistant-container-copy-data-home-assistant-core.sh b/tools/copy-data/home-assistant-container-copy-data-home-assistant-core.sh index cea3814c80c..e03f62f4276 100644 --- a/tools/copy-data/home-assistant-container-copy-data-home-assistant-core.sh +++ b/tools/copy-data/home-assistant-container-copy-data-home-assistant-core.sh @@ -11,7 +11,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn + read -r -p "Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh b/tools/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh index 9f13acca6cb..c6cb6c1d052 100644 --- a/tools/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh +++ b/tools/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh @@ -13,7 +13,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. Proceed(y/n)?" yn + read -r -p "Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/home-assistant-core-copy-data-home-assistant-container.sh b/tools/copy-data/home-assistant-core-copy-data-home-assistant-container.sh index 25591ae2dc0..1adafa81475 100644 --- a/tools/copy-data/home-assistant-core-copy-data-home-assistant-container.sh +++ b/tools/copy-data/home-assistant-core-copy-data-home-assistant-container.sh @@ -11,7 +11,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC. Proceed(y/n)?" yn + read -r -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/home-assistant-core-copy-data-home-assistant-core.sh b/tools/copy-data/home-assistant-core-copy-data-home-assistant-core.sh index 30347709a4c..213842c21c2 100644 --- a/tools/copy-data/home-assistant-core-copy-data-home-assistant-core.sh +++ b/tools/copy-data/home-assistant-core-copy-data-home-assistant-core.sh @@ -11,7 +11,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn + read -r -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/plex-copy-data-plex.sh b/tools/copy-data/plex-copy-data-plex.sh index 987eda9335c..6f52d4801f7 100644 --- a/tools/copy-data/plex-copy-data-plex.sh +++ b/tools/copy-data/plex-copy-data-plex.sh @@ -13,7 +13,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from one Plex Media Server LXC to another. Proceed(y/n)?" yn + read -r -p "Use to copy all data from one Plex Media Server LXC to another. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh b/tools/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh index a0aef23e8d3..a92c96d8c9b 100644 --- a/tools/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh +++ b/tools/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh @@ -13,7 +13,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. Proceed(y/n)?" yn + read -r -p "Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/z2m-copy-data-z2m.sh b/tools/copy-data/z2m-copy-data-z2m.sh index 785251bc0c1..febacd3db6d 100644 --- a/tools/copy-data/z2m-copy-data-z2m.sh +++ b/tools/copy-data/z2m-copy-data-z2m.sh @@ -13,7 +13,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from one Zigbee2MQTT LXC to another. Proceed(y/n)?" yn + read -r -p "Use to copy all data from one Zigbee2MQTT LXC to another. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh b/tools/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh index af39a58ffa6..711d4808d9d 100644 --- a/tools/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh +++ b/tools/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh @@ -13,7 +13,7 @@ if ! command -v pveversion >/dev/null 2>&1; then exit fi while true; do - read -p "Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC. Proceed(y/n)?" yn + read -r -p "Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/pve/add-iptag.sh b/tools/pve/add-iptag.sh index 8a0f423063b..7448d9634ee 100644 --- a/tools/pve/add-iptag.sh +++ b/tools/pve/add-iptag.sh @@ -128,7 +128,7 @@ update_installation() { if [[ -f "/opt/iptag/iptag.conf" ]]; then echo -e "\n${YW}Configuration file already exists.${CL}" while true; do - read -p "Do you want to replace it with defaults? (y/n): " yn + read -r -p "Do you want to replace it with defaults? (y/n): " yn case $yn in [Yy]*) msg_info "Replacing configuration file" @@ -1215,7 +1215,7 @@ EOF # Main installation process if check_service_exists; then while true; do - read -p "IP-Tag service is already installed. Do you want to update it? (y/n): " yn + read -r -p "IP-Tag service is already installed. Do you want to update it? (y/n): " yn case $yn in [Yy]*) update_installation @@ -1233,7 +1233,7 @@ if check_service_exists; then fi while true; do - read -p "This will install ${APP} on ${hostname}. Proceed? (y/n): " yn + read -r -p "This will install ${APP} on ${hostname}. Proceed? (y/n): " yn case $yn in [Yy]*) break diff --git a/tools/pve/clean-orphaned-lvm.sh b/tools/pve/clean-orphaned-lvm.sh index 4f47d5a94c1..42ae04e11d9 100644 --- a/tools/pve/clean-orphaned-lvm.sh +++ b/tools/pve/clean-orphaned-lvm.sh @@ -52,7 +52,7 @@ function delete_orphaned_lvm { vg="${orphaned_volumes[i + 1]}" size="${orphaned_volumes[i + 2]}" - read -p "❓ Do you want to delete $lv (VG: $vg, Size: $size)? [y/N]: " confirm + read -r -p "❓ Do you want to delete $lv (VG: $vg, Size: $size)? [y/N]: " confirm if [[ "$confirm" =~ ^[Yy]$ ]]; then echo -e "🗑️ Deleting $lv from $vg..." lvremove -f "$vg/$lv" diff --git a/tools/pve/container-restore-from-backup.sh b/tools/pve/container-restore-from-backup.sh index d1a45c6a960..8335974aa11 100644 --- a/tools/pve/container-restore-from-backup.sh +++ b/tools/pve/container-restore-from-backup.sh @@ -23,7 +23,7 @@ CM="${GN}✓${CL}" CROSS="${RD}✗${CL}" APP="Home Assistant Container" while true; do - read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn + read -r -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/pve/core-restore-from-backup.sh b/tools/pve/core-restore-from-backup.sh index bdff8dd4c2c..8b7f30ddc35 100644 --- a/tools/pve/core-restore-from-backup.sh +++ b/tools/pve/core-restore-from-backup.sh @@ -23,7 +23,7 @@ CM="${GN}✓${CL}" CROSS="${RD}✗${CL}" APP="Home Assistant Core" while true; do - read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn + read -r -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/pve/cron-update-lxcs.sh b/tools/pve/cron-update-lxcs.sh index 6d6fb3c5173..aff6f0b4bfb 100644 --- a/tools/pve/cron-update-lxcs.sh +++ b/tools/pve/cron-update-lxcs.sh @@ -18,7 +18,7 @@ EOF add() { while true; do - read -p "This script will add a crontab schedule that updates all LXCs every Sunday at midnight. Proceed(y/n)?" yn + read -r -p "This script will add a crontab schedule that updates all LXCs every Sunday at midnight. Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/pve/frigate-support.sh b/tools/pve/frigate-support.sh index 5c8ec6bfff7..1303d001143 100644 --- a/tools/pve/frigate-support.sh +++ b/tools/pve/frigate-support.sh @@ -17,7 +17,7 @@ EOF } header_info while true; do - read -p "This will Prepare a LXC Container for Frigate. Proceed (y/n)?" yn + read -r -p "This will Prepare a LXC Container for Frigate. Proceed (y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/pve/host-backup.sh b/tools/pve/host-backup.sh index 5de60fc7eaf..c1c28d7261e 100644 --- a/tools/pve/host-backup.sh +++ b/tools/pve/host-backup.sh @@ -59,7 +59,7 @@ function perform_backup { # Perform the backup header_info echo -e "This will create a backup in\e[1;33m $BACKUP_PATH \e[0mfor these files and directories\e[1;33m ${selected_directories[*]} \e[0m" - read -p "Press ENTER to continue..." + read -r -p "Press ENTER to continue..." header_info echo "Working..." tar -czf "$BACKUP_PATH$BACKUP_FILE-$(date +%Y_%m_%d).tar.gz" --absolute-names "${selected_directories[@]}" diff --git a/tools/pve/kernel-clean.sh b/tools/pve/kernel-clean.sh index 9efe71e6174..123605d6979 100644 --- a/tools/pve/kernel-clean.sh +++ b/tools/pve/kernel-clean.sh @@ -58,7 +58,7 @@ fi # Confirm removal echo -e "${YW}Kernels to be removed:${CL}" printf "%s\n" "${kernels_to_remove[@]}" -read -rp "Proceed with removal? (y/n): " confirm +read -r -p "Proceed with removal? (y/n): " confirm if [[ "$confirm" != "y" ]]; then echo -e "${RD}Aborted.${CL}" exit 1 diff --git a/tools/pve/lxc-delete.sh b/tools/pve/lxc-delete.sh index 8cadfda0ecb..4ce442011a8 100644 --- a/tools/pve/lxc-delete.sh +++ b/tools/pve/lxc-delete.sh @@ -71,7 +71,7 @@ if [ -z "$CHOICES" ]; then exit 1 fi -read -p "Delete containers manually or automatically? (Default: manual) m/a: " DELETE_MODE +read -r -p "Delete containers manually or automatically? (Default: manual) m/a: " DELETE_MODE DELETE_MODE=${DELETE_MODE:-m} selected_ids=$(echo "$CHOICES" | tr -d '"' | tr -s ' ' '\n') @@ -98,7 +98,7 @@ for container_id in $selected_ids; do spinner $pid [ $? -eq 0 ] && echo "Container $container_id deleted." || whiptail --title "Error" --msgbox "Failed to delete container $container_id." 10 60 else - read -p "Delete container $container_id? (y/N): " CONFIRM + read -r -p "Delete container $container_id? (y/N): " CONFIRM if [[ "$CONFIRM" =~ ^[Yy]$ ]]; then echo -e "${BL}[Info]${GN} Deleting container $container_id...${CL}" pct destroy "$container_id" -f & diff --git a/tools/pve/monitor-all.sh b/tools/pve/monitor-all.sh index 30795cce189..5b5058cf9dc 100644 --- a/tools/pve/monitor-all.sh +++ b/tools/pve/monitor-all.sh @@ -26,7 +26,7 @@ add() { echo while true; do - read -p "This script will add Monitor All to Proxmox VE. Proceed (y/n)? " yn + read -r -p "This script will add Monitor All to Proxmox VE. Proceed (y/n)? " yn case $yn in [Yy]*) break ;; [Nn]*) exit ;; diff --git a/tools/pve/pbs3-upgrade.sh b/tools/pve/pbs3-upgrade.sh index 502be4bfee0..87aa4c7c6a3 100644 --- a/tools/pve/pbs3-upgrade.sh +++ b/tools/pve/pbs3-upgrade.sh @@ -160,7 +160,7 @@ EOF header_info while true; do - read -p "Start the Update to Proxmox Backup Server 3 Script (y/n)?" yn + read -r -p "Start the Update to Proxmox Backup Server 3 Script (y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) diff --git a/tools/pve/post-pbs-install.sh b/tools/pve/post-pbs-install.sh index c564be1c05e..2b65cbf0d9b 100644 --- a/tools/pve/post-pbs-install.sh +++ b/tools/pve/post-pbs-install.sh @@ -167,7 +167,7 @@ EOF header_info echo -e "\nThis script will Perform Post Install Routines.\n" while true; do - read -p "Start the Proxmox Backup Server Post Install Script (y/n)?" yn + read -r -p "Start the Proxmox Backup Server Post Install Script (y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) diff --git a/tools/pve/post-pmg-install.sh b/tools/pve/post-pmg-install.sh index f3365786054..9a24ef89196 100644 --- a/tools/pve/post-pmg-install.sh +++ b/tools/pve/post-pmg-install.sh @@ -169,7 +169,7 @@ EOF header_info echo -e "\nThis script will Perform Post Install Routines.\n" while true; do - read -p "Start the Proxmox Mail Gateway Post Install Script (y/n)?" yn + read -r -p "Start the Proxmox Mail Gateway Post Install Script (y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) diff --git a/tools/pve/post-pve-install.sh b/tools/pve/post-pve-install.sh index 5afc3bd0292..baca025e0ab 100644 --- a/tools/pve/post-pve-install.sh +++ b/tools/pve/post-pve-install.sh @@ -235,7 +235,7 @@ EOF header_info echo -e "\nThis script will Perform Post Install Routines.\n" while true; do - read -p "Start the Proxmox VE Post Install Script (y/n)?" yn + read -r -p "Start the Proxmox VE Post Install Script (y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) diff --git a/tools/pve/pve-privilege-converter.sh b/tools/pve/pve-privilege-converter.sh index f26f02ab1d4..bd4f6c146d7 100644 --- a/tools/pve/pve-privilege-converter.sh +++ b/tools/pve/pve-privilege-converter.sh @@ -35,7 +35,7 @@ select_target_storage_and_container_id() { done while true; do - read -rp "Enter number of target storage: " choice + read -r -p "Enter number of target storage: " choice if [[ "$choice" =~ ^[0-9]+$ ]] && ((choice >= 1 && choice <= ${#target_storages[@]})); then TARGET_STORAGE="${target_storages[$((choice - 1))]}" break @@ -48,7 +48,7 @@ select_target_storage_and_container_id() { [[ "$next_free_id" =~ ^[0-9]+$ ]] || next_free_id=999 echo "" - read -rp "Suggested next free container ID: $next_free_id. Enter new container ID [default: $next_free_id]: " NEW_CONTAINER_ID + read -r -p "Suggested next free container ID: $next_free_id. Enter new container ID [default: $next_free_id]: " NEW_CONTAINER_ID NEW_CONTAINER_ID="${NEW_CONTAINER_ID:-$next_free_id}" } @@ -129,7 +129,7 @@ perform_conversion() { } manage_states() { - read -rp "Shutdown source and start new container? [Y/n]: " answer + read -r -p "Shutdown source and start new container? [Y/n]: " answer answer=${answer:-Y} if [[ $answer =~ ^[Yy] ]]; then pct shutdown "$CONTAINER_ID" @@ -138,7 +138,7 @@ manage_states() { ! pct status "$CONTAINER_ID" | grep -q running && break done if pct status "$CONTAINER_ID" | grep -q running; then - read -rp "Timeout reached. Force shutdown? [Y/n]: " force + read -r -p "Timeout reached. Force shutdown? [Y/n]: " force if [[ ${force:-Y} =~ ^[Yy] ]]; then pkill -9 -f "lxc-start -F -n $CONTAINER_ID" fi @@ -151,7 +151,7 @@ manage_states() { } cleanup_files() { - read -rp "Delete backup archive? [$BACKUP_PATH] [Y/n]: " cleanup + read -r -p "Delete backup archive? [$BACKUP_PATH] [Y/n]: " cleanup if [[ ${cleanup:-Y} =~ ^[Yy] ]]; then rm -f "$BACKUP_PATH" && msg_ok "Removed backup archive" else diff --git a/tools/pve/pve8-upgrade.sh b/tools/pve/pve8-upgrade.sh index 7e575f0f1e2..3516b4c8412 100644 --- a/tools/pve/pve8-upgrade.sh +++ b/tools/pve/pve8-upgrade.sh @@ -110,7 +110,7 @@ EOF header_info while true; do - read -p "Start the Update to Proxmox VE 8 Script (y/n)?" yn + read -r -p "Start the Update to Proxmox VE 8 Script (y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) diff --git a/tools/pve/usb-passthrough.sh b/tools/pve/usb-passthrough.sh index 58dab9a2398..44a3e177c73 100644 --- a/tools/pve/usb-passthrough.sh +++ b/tools/pve/usb-passthrough.sh @@ -7,7 +7,7 @@ echo -e "\e[1;33m This script will allow USB passthrough to a PRIVILEGED LXC Container ONLY\e[0m" while true; do - read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn + read -r -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn case $yn in [Yy]*) break ;; [Nn]*) exit ;;