-
-
Save tinjaw/afe0817b784a931aadb73024171a6af0 to your computer and use it in GitHub Desktop.
Synology move packages to another volume
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script moves ALL packages from volume-x to volume-y | |
# For Synology DSM - tested with DSM6.1 | |
if [ $# -lt 2 ]; then | |
echo "usage: $0 <from_vol> <to_vol>" | |
exit -1 | |
fi | |
from_vol="$1" | |
to_vol="$2" | |
from_path="/$from_vol/\@appstore/" | |
to_path="/$to_vol/\@appstore/" | |
move_package () { | |
echo "##############################################################" | |
echo "moving package $1 from $2 to $3" | |
# You might want to stop stuff manually as doing it this | |
# way doesn't take into consideration dependencies. | |
echo ":::: stopping package $1 ..." | |
/var/packages/$1/scripts/start-stop-status stop | |
echo ":::: removing link to package from $2 ..." | |
rm -fv /var/packages/$1/target | |
echo ":::: moving package $1 to $3 ..." | |
mv /$2/\@appstore/$1 /$3/\@appstore/ | |
echo ":::: adding link to package to $3 ..." | |
ln -s /$3/\@appstore/$1 /var/packages/$1/target | |
# You might want to start stuff manually as doing it this | |
# way doesn't take into consideration dependencies. | |
echo ":::: starting package $1 on new location ..." | |
/var/packages/$1/scripts/start-stop-status start | |
} | |
# scanning the @appstore folder for packages | |
for d in $from_path*/ ; do | |
package_name="$(basename $d)" | |
move_package $package_name $from_vol $to_vol | |
done | |
echo "##############################################################" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment