diff --git a/misc/zwave-copy-data.sh b/misc/zwave-copy-data.sh index 728fbaf7..4b6de0d1 100644 --- a/misc/zwave-copy-data.sh +++ b/misc/zwave-copy-data.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash -# Use to copy all data from one Zwavejs2MQTT LXC to another +# Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC # run from the Proxmox Shell # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/zwave-copy-data.sh)" while true; do - read -p "Use to copy all data from one Zwavejs2MQTT LXC to another. Proceed(y/n)?" yn + read -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;; @@ -51,7 +51,7 @@ function cleanup() { TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null -TITLE="Zigbee2MQTT LXC Data Copy" +TITLE="Zigbee2MQTT to Z-wave JS UI Data Copy" while read -r line; do TAG=$(echo "$line" | awk '{print $1}') ITEM=$(echo "$line" | awk '{print substr($0,36)}') @@ -69,7 +69,7 @@ while [ -z "${CTID_FROM:+x}" ]; do done while [ -z "${CTID_TO:+x}" ]; do CTID_TO=$(whiptail --title "$TITLE" --radiolist \ - "\nWhich Zwavejs2MQTT LXC would you like to copy TO?\n" \ + "\nWhich Z-wave JS UI LXC would you like to copy TO?\n" \ 16 $(($MSG_MAX_LENGTH + 23)) 6 \ "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit done @@ -82,7 +82,7 @@ done whiptail --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.03.06" 13 50 || exit +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 msg "Stopping '$CTID_TO'..." @@ -90,13 +90,14 @@ if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then 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") || \ 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") || \ die "There was a problem mounting the root disk of LXC '${CTID_TO}'." -[ -d "${CTID_TO_PATH}${DATA_PATH}" ] || \ +[ -d "${CTID_TO_PATH}${DATA_PATH_NEW}" ] || \ die "Zwavejs2MQTT directories in '$CTID_TO' not found." #rm -rf ${CTID_TO_PATH}${DATA_PATH} @@ -111,8 +112,8 @@ RSYNC_OPTIONS=( --no-inc-recursive --info=progress2 ) -msg "<======== Zwavejs2MQTT Data ========>" -rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DATA_PATH} ${CTID_TO_PATH}${DATA_PATH} +msg "<======== Zwavejs Data ========>" +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."