tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2025-01-21 00:52:51 +03:00
parent 97e97f468a
commit e0165aa370

View File

@ -9,7 +9,7 @@ PATH=$PATH:$(dirname "$(pwd)")
# full # full
# list # list
# <empty> # <empty>
MIGRATE_CACHE=full MIGRATE_CACHE=${MIGRATE_CACHE:-full}
# NOTE: paths here are relative to appdata_<instance_id>/ # NOTE: paths here are relative to appdata_<instance_id>/
MIGRATE_CACHE_FILES=( MIGRATE_CACHE_FILES=(
@ -75,8 +75,10 @@ TO=$2
/var/lib/lxc/$TO/rootfs/var/www/nextcloud-data /var/lib/lxc/$TO/rootfs/var/www/nextcloud-data
# migrate cache... # migrate cache...
if [ -e "$FROM_THEME_DIR" ] ; then if ! [ -z "$DRY_RUN" ] \
|| [ -e "$FROM_THEME_DIR" ] ; then
# instance id's... # instance id's...
# XXX not sure how to deal with $DRY_RUN here...
FROM_INSTANCEID=$(lxc-attach $FROM -- turnkey-occ config:system:get instanceid) FROM_INSTANCEID=$(lxc-attach $FROM -- turnkey-occ config:system:get instanceid)
TO_INSTANCEID=$(lxc-attach $TO -- turnkey-occ config:system:get instanceid) TO_INSTANCEID=$(lxc-attach $TO -- turnkey-occ config:system:get instanceid)
@ -85,7 +87,7 @@ if [ -e "$FROM_THEME_DIR" ] ; then
# migrate theming and other instance files... # migrate theming and other instance files...
APPDATA=/var/lib/lxc/$TO/rootfs/var/www/nextcloud-data/appdata_$TO_INSTANCEID APPDATA=/var/lib/lxc/$TO/rootfs/var/www/nextcloud-data/appdata_$TO_INSTANCEID
[ -e "$APPDATA" ] \ [ -e "$APPDATA" ] \
&& mv -f "$APPDATA" "${APPDATA}.bak" && @ mv -f "$APPDATA" "${APPDATA}.bak"
@ mv -f \ @ mv -f \
/var/lib/lxc/$TO/rootfs/var/www/nextcloud-data/appdata_$FROM_INSTANCEID \ /var/lib/lxc/$TO/rootfs/var/www/nextcloud-data/appdata_$FROM_INSTANCEID \
"$APPDATA" "$APPDATA"
@ -97,11 +99,12 @@ if [ -e "$FROM_THEME_DIR" ] ; then
for f in "${MIGRATE_CACHE_FILES[@]}" ; do for f in "${MIGRATE_CACHE_FILES[@]}" ; do
from=${FROM_CACHE_DIR}/$f from=${FROM_CACHE_DIR}/$f
to=${TO_CACHE_DIR}/$f to=${TO_CACHE_DIR}/$f
if ! [ -e "$from" ] ; then if [ -z "$DRY_RUN" ] \
&& ! [ -e "$from" ] ; then
continue continue
fi fi
mkdir -p "$(dirname "$to")" @ mkdir -p "$(dirname "$to")"
cp -r "$from" "$to" @ cp -r "$from" "$to"
done done
fi fi
fi fi