mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-16 15:31:53 +00:00
move copy-data to tools
This commit is contained in:
parent
bdb7f21e2f
commit
038f4e144b
@ -2,45 +2,45 @@
|
||||
<div align="center"> To copy data from Home Assistant Container to Home Assistant Container </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/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/tools/copy-data/home-assistant-container-copy-data-home-assistant-container.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Home Assistant Container to Home Assistant Core </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/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/tools/copy-data/home-assistant-container-copy-data-home-assistant-core.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Home Assistant Container to Podman Home Assistant </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/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/tools/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Podman Home Assistant to Home Assistant Container </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/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/tools/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Home Assistant Core to Home Assistant Container </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/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/tools/copy-data/home-assistant-core-copy-data-home-assistant-container.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Home Assistant Core to Home Assistant Core </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/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/tools/copy-data/home-assistant-core-copy-data-home-assistant-core.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Plex to Plex </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/plex-copy-data-plex.sh)"
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/copy-data/plex-copy-data-plex.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Zigbee2MQTT to Zigbee2MQTT </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/z2m-copy-data-z2m.sh)"
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/copy-data/z2m-copy-data-z2m.sh)"
|
||||
```
|
||||
<div align="center"> To copy data from Zwavejs2MQTT to Zwave JS UI </div>
|
||||
|
||||
```
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh)"
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh)"
|
||||
```
|
@ -35,7 +35,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"
|
||||
@ -52,13 +52,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="Home Assistant LXC Data Copy"
|
||||
while read -r line; do
|
||||
@ -84,32 +84,32 @@ 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.01.23" 13 50 || exit
|
||||
info "Home Assistant 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..."
|
||||
DOCKER_PATH=/var/lib/docker/volumes/hass_config/
|
||||
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}${DOCKER_PATH}" ] ||
|
||||
die "Home Assistant 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}${DOCKER_PATH}" ] ||
|
||||
die "Home Assistant directories in '$CTID_TO' not found."
|
||||
|
||||
rm -rf ${CTID_TO_PATH}${DOCKER_PATH}
|
||||
mkdir ${CTID_TO_PATH}${DOCKER_PATH}
|
||||
rm -rf "${CTID_TO_PATH}"${DOCKER_PATH}
|
||||
mkdir "${CTID_TO_PATH}"${DOCKER_PATH}
|
||||
|
||||
msg "Copying Data Between Containers..."
|
||||
RSYNC_OPTIONS=(
|
||||
@ -121,11 +121,11 @@ RSYNC_OPTIONS=(
|
||||
--info=progress2
|
||||
)
|
||||
msg "<======== Docker Data ========>"
|
||||
rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DOCKER_PATH} ${CTID_TO_PATH}${DOCKER_PATH}
|
||||
rsync "${RSYNC_OPTIONS[*]}" "${CTID_FROM_PATH}"${DOCKER_PATH} "${CTID_TO_PATH}"${DOCKER_PATH}
|
||||
echo -en "\e[1A\e[0K\e[1A\e[0K"
|
||||
|
||||
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/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//home-assistant-container-copy-data-home-assistant-container.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/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//home-assistant-container-copy-data-home-assistant-core.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/main/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//home-assistant-container-copy-data-podman-home-assistant.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/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//home-assistant-core-copy-data-home-assistant-container.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/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//home-assistant-core-copy-data-home-assistant-core.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/main/misc/copy-data/plex-copy-data-plex.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//plex-copy-data-plex.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/main/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//podman-home-assistant-copy-data-home-assistant-container.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/main/misc/copy-data/z2m-copy-data-z2m.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//z2m-copy-data-z2m.sh)"
|
@ -130,4 +130,4 @@ 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/main/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh)"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/mainmain/tools/copy-data//zwavejs2mqtt-copy-data-zwavejsui.sh)"
|
Loading…
x
Reference in New Issue
Block a user