mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-23 04:17:32 +01:00
Compare commits
1 Commits
dev
...
blitz.data
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91419ddafa |
@@ -1144,6 +1144,21 @@ if [ "$action" = "link" ]; then
|
|||||||
if [ -d "${storageMountedPath}/bitcoin" ]; then
|
if [ -d "${storageMountedPath}/bitcoin" ]; then
|
||||||
/home/admin/_cache.sh set message "hdd-migrate"
|
/home/admin/_cache.sh set message "hdd-migrate"
|
||||||
echo "# moving old data from ${storageMountedPath}/bitcoin to ${storageMountedPath}/app-storage/bitcoin"
|
echo "# moving old data from ${storageMountedPath}/bitcoin to ${storageMountedPath}/app-storage/bitcoin"
|
||||||
|
# Check if source and destination are on the same filesystem
|
||||||
|
srcDevice=$(stat -c %d "${storageMountedPath}/bitcoin" 2>/dev/null)
|
||||||
|
dstDevice=$(stat -c %d "${storageMountedPath}/app-storage" 2>/dev/null)
|
||||||
|
if [ "${srcDevice}" = "${dstDevice}" ] && [ -n "${srcDevice}" ]; then
|
||||||
|
# Same filesystem - use mv (instant, just updates directory entries)
|
||||||
|
echo "# same filesystem detected - using mv for instant move"
|
||||||
|
mv ${storageMountedPath}/bitcoin/* ${storageMountedPath}/app-storage/bitcoin/ 2>/dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "error='failed to move ${storageMountedPath}/bitcoin/* to ${storageMountedPath}/app-storage/bitcoin/'"
|
||||||
|
else
|
||||||
|
rm -rf ${storageMountedPath}/bitcoin
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Different filesystems - use rsync (copies data, slower but safe)
|
||||||
|
echo "# different filesystems detected - using rsync"
|
||||||
rsync -a --remove-source-files --prune-empty-dirs ${storageMountedPath}/bitcoin/ ${storageMountedPath}/app-storage/bitcoin/
|
rsync -a --remove-source-files --prune-empty-dirs ${storageMountedPath}/bitcoin/ ${storageMountedPath}/app-storage/bitcoin/
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "error='failed to move ${storageMountedPath}/bitcoin/* to ${storageMountedPath}/app-storage/bitcoin/'"
|
echo "error='failed to move ${storageMountedPath}/bitcoin/* to ${storageMountedPath}/app-storage/bitcoin/'"
|
||||||
@@ -1151,6 +1166,7 @@ if [ "$action" = "link" ]; then
|
|||||||
rm -rf ${storageMountedPath}/bitcoin
|
rm -rf ${storageMountedPath}/bitcoin
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
if [ -d "${storageMountedPath}/app-storage/bitcoin/wallet.dat" ]; then
|
if [ -d "${storageMountedPath}/app-storage/bitcoin/wallet.dat" ]; then
|
||||||
echo "# moving old wallet from ${storageMountedPath}/app-storage/bitcoin/wallet.dat to ${dataMountedPath}/app-data/bitcoin/wallets/wallet.dat"
|
echo "# moving old wallet from ${storageMountedPath}/app-storage/bitcoin/wallet.dat to ${dataMountedPath}/app-data/bitcoin/wallets/wallet.dat"
|
||||||
mv --force ${storageMountedPath}/app-storage/bitcoin/wallet.dat ${dataMountedPath}/app-data/bitcoin/wallets/wallet.dat
|
mv --force ${storageMountedPath}/app-storage/bitcoin/wallet.dat ${dataMountedPath}/app-data/bitcoin/wallets/wallet.dat
|
||||||
@@ -1183,6 +1199,21 @@ if [ "$action" = "link" ]; then
|
|||||||
if [ -d "${storageMountedPath}/lnd" ]; then
|
if [ -d "${storageMountedPath}/lnd" ]; then
|
||||||
/home/admin/_cache.sh set message "hdd-migrate"
|
/home/admin/_cache.sh set message "hdd-migrate"
|
||||||
echo "# moving old data from ${storageMountedPath}/lnd to ${dataMountedPath}/app-data/lnd"
|
echo "# moving old data from ${storageMountedPath}/lnd to ${dataMountedPath}/app-data/lnd"
|
||||||
|
# Check if source and destination are on the same filesystem
|
||||||
|
srcDevice=$(stat -c %d "${storageMountedPath}/lnd" 2>/dev/null)
|
||||||
|
dstDevice=$(stat -c %d "${dataMountedPath}/app-data" 2>/dev/null)
|
||||||
|
if [ "${srcDevice}" = "${dstDevice}" ] && [ -n "${srcDevice}" ]; then
|
||||||
|
# Same filesystem - use mv (instant, just updates directory entries)
|
||||||
|
echo "# same filesystem detected - using mv for instant move"
|
||||||
|
mv ${storageMountedPath}/lnd/* ${dataMountedPath}/app-data/lnd/ 2>/dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "error='failed to move /app-data/lnd/'"
|
||||||
|
else
|
||||||
|
rm -rf ${storageMountedPath}/lnd
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Different filesystems - use rsync (copies data, slower but safe)
|
||||||
|
echo "# different filesystems detected - using rsync"
|
||||||
rsync -a --remove-source-files --prune-empty-dirs ${storageMountedPath}/lnd/ ${dataMountedPath}/app-data/lnd/
|
rsync -a --remove-source-files --prune-empty-dirs ${storageMountedPath}/lnd/ ${dataMountedPath}/app-data/lnd/
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "error='failed to rsync /app-data/lnd/'"
|
echo "error='failed to rsync /app-data/lnd/'"
|
||||||
@@ -1190,6 +1221,7 @@ if [ "$action" = "link" ]; then
|
|||||||
rm -rf ${storageMountedPath}/lnd
|
rm -rf ${storageMountedPath}/lnd
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
echo "# For backwards compatibility: Liniking ${mainMountPoint}/lnd"
|
echo "# For backwards compatibility: Liniking ${mainMountPoint}/lnd"
|
||||||
unlink ${mainMountPoint}/lnd 2>/dev/null
|
unlink ${mainMountPoint}/lnd 2>/dev/null
|
||||||
if [ -d "${mainMountPoint}/lnd" ]; then
|
if [ -d "${mainMountPoint}/lnd" ]; then
|
||||||
@@ -1206,6 +1238,21 @@ if [ "$action" = "link" ]; then
|
|||||||
if [ -d "${storageMountedPath}/tor" ]; then
|
if [ -d "${storageMountedPath}/tor" ]; then
|
||||||
/home/admin/_cache.sh set message "hdd-migrate"
|
/home/admin/_cache.sh set message "hdd-migrate"
|
||||||
echo "# moving old data from ${storageMountedPath}/tor to ${dataMountedPath}/app-data/tor"
|
echo "# moving old data from ${storageMountedPath}/tor to ${dataMountedPath}/app-data/tor"
|
||||||
|
# Check if source and destination are on the same filesystem
|
||||||
|
srcDevice=$(stat -c %d "${storageMountedPath}/tor" 2>/dev/null)
|
||||||
|
dstDevice=$(stat -c %d "${dataMountedPath}/app-data" 2>/dev/null)
|
||||||
|
if [ "${srcDevice}" = "${dstDevice}" ] && [ -n "${srcDevice}" ]; then
|
||||||
|
# Same filesystem - use mv (instant, just updates directory entries)
|
||||||
|
echo "# same filesystem detected - using mv for instant move"
|
||||||
|
mv ${storageMountedPath}/tor/* ${dataMountedPath}/app-data/tor/ 2>/dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "error='failed to move /app-data/tor/'"
|
||||||
|
else
|
||||||
|
rm -rf ${storageMountedPath}/tor
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Different filesystems - use rsync (copies data, slower but safe)
|
||||||
|
echo "# different filesystems detected - using rsync"
|
||||||
rsync -a --remove-source-files --prune-empty-dirs ${storageMountedPath}/tor/ ${dataMountedPath}/app-data/tor/
|
rsync -a --remove-source-files --prune-empty-dirs ${storageMountedPath}/tor/ ${dataMountedPath}/app-data/tor/
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "error='failed to rsync /app-data/tor/'"
|
echo "error='failed to rsync /app-data/tor/'"
|
||||||
@@ -1213,6 +1260,7 @@ if [ "$action" = "link" ]; then
|
|||||||
rm -rf ${storageMountedPath}/tor
|
rm -rf ${storageMountedPath}/tor
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
echo "# For backwards compatibility: Liniking ${mainMountPoint}/tor"
|
echo "# For backwards compatibility: Liniking ${mainMountPoint}/tor"
|
||||||
unlink ${mainMountPoint}/tor 2>/dev/null
|
unlink ${mainMountPoint}/tor 2>/dev/null
|
||||||
if [ -d "${mainMountPoint}/tor" ]; then
|
if [ -d "${mainMountPoint}/tor" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user