From 23c01141db5c92bca67fa0d104678ab57d9bfe0d Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 4 Apr 2025 16:05:12 +0200 Subject: [PATCH] core: fix raw path (#3656) --- frontend/public/json/cron-update-lxcs.json | 4 +-- install/daemonsync-install.sh | 2 +- misc/alpine-install.func | 6 ++--- ...iner-copy-data-home-assistant-container.sh | 2 +- ...container-copy-data-home-assistant-core.sh | 2 +- ...ntainer-copy-data-podman-home-assistant.sh | 2 +- ...core-copy-data-home-assistant-container.sh | 2 +- ...tant-core-copy-data-home-assistant-core.sh | 2 +- misc/copy-data/plex-copy-data-plex.sh | 2 +- ...tant-copy-data-home-assistant-container.sh | 2 +- misc/copy-data/z2m-copy-data-z2m.sh | 2 +- .../zwavejs2mqtt-copy-data-zwavejsui.sh | 26 +++++++++---------- misc/cron-update-lxcs.sh | 4 +-- misc/frigate-support.sh | 2 +- misc/hw-acceleration.sh | 2 +- misc/install.func | 14 +++++----- 16 files changed, 38 insertions(+), 38 deletions(-) diff --git a/frontend/public/json/cron-update-lxcs.json b/frontend/public/json/cron-update-lxcs.json index fd7e1dac5..e02f37ea6 100644 --- a/frontend/public/json/cron-update-lxcs.json +++ b/frontend/public/json/cron-update-lxcs.json @@ -36,9 +36,9 @@ "type": "info" }, { - "text": "To exclude LXCs from updating, edit the crontab using `crontab -e` and add CTID as shown in the example below:\n\n\n\n`0 0 * * 0 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /bin/bash -c '$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/update-lxcs-cron.sh)' -s 103 111 >>/var/log/update-lxcs-cron.log 2>/dev/null`", + "text": "To exclude LXCs from updating, edit the crontab using `crontab -e` and add CTID as shown in the example below:\n\n\n\n`0 0 * * 0 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /bin/bash -c '$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/update-lxcs-cron.sh)' -s 103 111 >>/var/log/update-lxcs-cron.log 2>/dev/null`", "type": "info" } ] -} \ No newline at end of file +} diff --git a/install/daemonsync-install.sh b/install/daemonsync-install.sh index 4ea4bda35..5bc9581d9 100644 --- a/install/daemonsync-install.sh +++ b/install/daemonsync-install.sh @@ -18,7 +18,7 @@ $STD apt-get install -y g++-multilib msg_ok "Installed Dependencies" msg_info "Installing Daemon Sync Server" -curl -fsSL "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/daemonsync_2.2.0.0059_amd64.deb" -o "daemonsync_2.2.0.0059_amd64.deb" +curl -fsSL "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/daemonsync_2.2.0.0059_amd64.deb" -o "daemonsync_2.2.0.0059_amd64.deb" $STD dpkg -i daemonsync_2.2.0.0059_amd64.deb msg_ok "Installed Daemon Sync Server" diff --git a/misc/alpine-install.func b/misc/alpine-install.func index ace59a9f8..77e306ff0 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -94,12 +94,12 @@ msg_error() { # This function sets up the Container OS by generating the locale, setting the timezone, and checking the network connection setting_up_container() { msg_info "Setting up Container OS" - while [ $i -gt 0 ]; do + while [ "$i" -gt 0 ]; do if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then break fi echo 1>&2 -en "${CROSS}${RD} No Network! " - sleep $RETRY_EVERY + sleep "$RETRY_EVERY" i=$((i - 1)) done @@ -194,6 +194,6 @@ customize() { msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update } diff --git a/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh b/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh index a332fdf98..c9f0fc578 100644 --- a/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh +++ b/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh @@ -128,4 +128,4 @@ info "Successfully Transferred Data." # Use to copy all data from one Home Assistant LXC to another # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh)" diff --git a/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh b/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh index 24e08d755..7b6529d75 100644 --- a/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh +++ b/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh @@ -124,4 +124,4 @@ info "Successfully Transferred Data." # Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh)" diff --git a/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh b/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh index 16300af5d..4fc81bdcd 100644 --- a/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh +++ b/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh @@ -129,4 +129,4 @@ info "Successfully Transferred Data." # Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh)" diff --git a/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh b/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh index 607186589..7af0a0b0f 100644 --- a/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh +++ b/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh @@ -124,4 +124,4 @@ info "Successfully Transferred Data." # Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh)" diff --git a/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh b/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh index 21a1fb4e3..a674f70ac 100644 --- a/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh +++ b/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh @@ -123,4 +123,4 @@ info "Successfully Transferred Data." # Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh)" diff --git a/misc/copy-data/plex-copy-data-plex.sh b/misc/copy-data/plex-copy-data-plex.sh index c4ec2425a..77417fa28 100644 --- a/misc/copy-data/plex-copy-data-plex.sh +++ b/misc/copy-data/plex-copy-data-plex.sh @@ -128,4 +128,4 @@ info "Successfully Transferred Data." # Use to copy all data from one Plex Media Server LXC to another # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/plex-copy-data-plex.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/plex-copy-data-plex.sh)" diff --git a/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh b/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh index 091f3dc20..b03bde931 100644 --- a/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh +++ b/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh @@ -129,4 +129,4 @@ info "Successfully Transferred Data." # Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh)" diff --git a/misc/copy-data/z2m-copy-data-z2m.sh b/misc/copy-data/z2m-copy-data-z2m.sh index 799c248d5..b08273f1e 100644 --- a/misc/copy-data/z2m-copy-data-z2m.sh +++ b/misc/copy-data/z2m-copy-data-z2m.sh @@ -128,4 +128,4 @@ info "Successfully Transferred Data." # Use to copy all data from one Zigbee2MQTT LXC to another # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/z2m-copy-data-z2m.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/z2m-copy-data-z2m.sh)" diff --git a/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh b/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh index 5f3c7ffd2..ae14b27b4 100644 --- a/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh +++ b/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh @@ -36,7 +36,7 @@ function error_exit() { local REASON="\e[97m${1:-$DEFAULT}\e[39m" local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" msg "$FLAG $REASON" - exit $EXIT + exit "$EXIT" } function warn() { local REASON="\e[97m$1\e[39m" @@ -53,13 +53,13 @@ function msg() { echo -e "$TEXT" } function cleanup() { - [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM - [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount "$CTID_FROM" + [ -d "${CTID_TO_PATH:-}" ] && pct unmount "$CTID_TO" popd >/dev/null - rm -rf $TEMP_DIR + rm -rf "$TEMP_DIR" } TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null +pushd "$TEMP_DIR" >/dev/null TITLE="Zigbee2MQTT to Z-wave JS UI Data Copy" while read -r line; do @@ -85,27 +85,27 @@ while [ -z "${CTID_TO:+x}" ]; do done for i in ${!CTID_MENU[@]}; do [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && - CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<"${CTID_MENU[$i + 1]}") [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && - CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<"${CTID_MENU[$i + 1]}") done whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ "Are you sure you want to copy data between the following LXCs? $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) Version: 2022.09.21" 13 50 || exit info "Zwavejs2MQTT Data from '$CTID_FROM' to '$CTID_TO'" -if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then +if [ $(pct status "$CTID_TO" | sed 's/.* //') == 'running' ]; then msg "Stopping '$CTID_TO'..." - pct stop $CTID_TO + pct stop "$CTID_TO" fi msg "Mounting Container Disks..." DATA_PATH=/opt/zwavejs2mqtt/store/ DATA_PATH_NEW=/opt/zwave-js-ui/store/ -CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || +CTID_FROM_PATH=$(pct mount "$CTID_FROM" | sed -n "s/.*'\(.*\)'/\1/p") || die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." [ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || die "Zwavejs2MQTT directories in '$CTID_FROM' not found." -CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || +CTID_TO_PATH=$(pct mount "$CTID_TO" | sed -n "s/.*'\(.*\)'/\1/p") || die "There was a problem mounting the root disk of LXC '${CTID_TO}'." [ -d "${CTID_TO_PATH}${DATA_PATH_NEW}" ] || die "Zwavejs2MQTT directories in '$CTID_TO' not found." @@ -123,11 +123,11 @@ RSYNC_OPTIONS=( --info=progress2 ) msg "<======== Zwavejs Data ========>" -rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DATA_PATH} ${CTID_TO_PATH}${DATA_PATH_NEW} +rsync "${RSYNC_OPTIONS[*]}" "${CTID_FROM_PATH}"${DATA_PATH} "${CTID_TO_PATH}"${DATA_PATH_NEW} echo -en "\e[1A\e[0K\e[1A\e[0K" info "Successfully Transferred Data." # Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC # run from the Proxmox Shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh)" diff --git a/misc/cron-update-lxcs.sh b/misc/cron-update-lxcs.sh index 419cf477a..6cb4da56a 100644 --- a/misc/cron-update-lxcs.sh +++ b/misc/cron-update-lxcs.sh @@ -4,7 +4,7 @@ # Author: tteck (tteckster) # License: MIT # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/cron-update-lxcs.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/cron-update-lxcs.sh)" clear cat <<"EOF" @@ -25,7 +25,7 @@ add() { *) echo "Please answer yes or no." ;; esac done - sh -c '(crontab -l -u root 2>/dev/null; echo "0 0 * * 0 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/update-lxcs-cron.sh)\" >>/var/log/update-lxcs-cron.log 2>/dev/null") | crontab -u root -' + sh -c '(crontab -l -u root 2>/dev/null; echo "0 0 * * 0 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/update-lxcs-cron.sh)\" >>/var/log/update-lxcs-cron.log 2>/dev/null") | crontab -u root -' clear echo -e "\n To view Cron Update LXCs logs: cat /var/log/update-lxcs-cron.log" } diff --git a/misc/frigate-support.sh b/misc/frigate-support.sh index 2ca7691ba..0c5c93cdb 100644 --- a/misc/frigate-support.sh +++ b/misc/frigate-support.sh @@ -89,5 +89,5 @@ EOF echo -e "\e[1;33m \nFinished....Reboot ${CTID} LXC to apply the changes.\n \e[0m" # In the Proxmox web shell run -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/frigate-support.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/frigate-support.sh)" # Reboot the LXC to apply the changes diff --git a/misc/hw-acceleration.sh b/misc/hw-acceleration.sh index 7370b078f..3c5d4c4bb 100644 --- a/misc/hw-acceleration.sh +++ b/misc/hw-acceleration.sh @@ -5,7 +5,7 @@ # License: MIT # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Execute within the Proxmox shell -# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/hw-acceleration.sh)" +# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/hw-acceleration.sh)" set -e function header_info { diff --git a/misc/install.func b/misc/install.func index 85b2f489f..6c0aab6c4 100644 --- a/misc/install.func +++ b/misc/install.func @@ -69,7 +69,7 @@ catch_errors() { # This function handles errors error_handler() { source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) - if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi + if [ -n "$SPINNER_PID" ] && ps -p "$SPINNER_PID" >/dev/null; then kill "$SPINNER_PID" >/dev/null; fi printf "\e[?25h" local exit_code="$?" local line_number="$1" @@ -110,7 +110,7 @@ msg_info() { # This function displays a success message with a green color. msg_ok() { - if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi + if [ -n "$SPINNER_PID" ] && ps -p "$SPINNER_PID" >/dev/null; then kill "$SPINNER_PID" >/dev/null; fi printf "\e[?25h" local msg="$1" echo -e "${BFR}${CM}${GN}${msg}${CL}" @@ -118,7 +118,7 @@ msg_ok() { # This function displays a error message with a red color. msg_error() { - if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi + if [ -n "$SPINNER_PID" ] && ps -p "$SPINNER_PID" >/dev/null; then kill "$SPINNER_PID" >/dev/null; fi printf "\e[?25h" local msg="$1" echo -e "${BFR}${CROSS}${RD}${msg}${CL}" @@ -132,14 +132,14 @@ setting_up_container() { echo "LANG=${locale_line}" >/etc/default/locale locale-gen >/dev/null export LANG=${locale_line} - echo $tz >/etc/timezone - ln -sf /usr/share/zoneinfo/$tz /etc/localtime + echo "$tz" >/etc/timezone + ln -sf /usr/share/zoneinfo/"$tz" /etc/localtime for ((i = RETRY_NUM; i > 0; i--)); do if [ "$(hostname -I)" != "" ]; then break fi echo 1>&2 -en "${CROSS}${RD} No Network! " - sleep $RETRY_EVERY + sleep "$RETRY_EVERY" done if [ "$(hostname -I)" = "" ]; then echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" @@ -265,7 +265,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then