Skip to content

Instantly share code, notes, and snippets.

@ex-nerd
Last active December 26, 2015 14:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ex-nerd/e5c40242897b1eeabe4f to your computer and use it in GitHub Desktop.
Save ex-nerd/e5c40242897b1eeabe4f to your computer and use it in GitHub Desktop.
Synology Crashplan upgrade
# Fix a failed Crashplan upgrade on a Synology NAS.
# This function should be run directly on the NAS, as root.
#
# Based on Chris Nelson's blog post from here:
# http://chrisnelson.ca/2015/07/02/fixing-crashplan-4-3-0-on-synology/
function do_crashplan_upgrade() {
cp_target_dir="/var/packages/CrashPlan/target"
cp_upgrade_jar=`ls -t -1 "$cp_target_dir/upgrade/"*jar | head -n1`
cp_version=`basename "$cp_upgrade_jar" .jar`
if [[ -z $cp_version ]]; then
echo "Can't find crashplan upgrade jar file"
return
fi
unzip -o "$cp_upgrade_jar" "*.jar" -d "$cp_target_dir/lib/"
unzip -o "$cp_upgrade_jar" "lang/*" -d "$cp_target_dir/"
# This was required for old upgrades. Don't seem to need it anymore:
# unzip -o "$cp_upgrade_jar" run.conf -d "$cp_target_dir/bin/"
# This decommissions the most recent upgrade file so CP will regenerate it.
# upgrade_file=`ls -t -d "cp_target_dir/upgrade/$cp_version".*/upgrade.sh | head -n1`
# mv "$upgrade_file" "$upgrade_file".old
# ... or just decommission all of them
for upgrade_file in /var/packages/CrashPlan/target/upgrade/$cp_version.*/upgrade.sh; do
mv "$upgrade_file" "$upgrade_file".old
done
echo "Upgrade prep work completed for version $cp_version."
echo "Now, you should log into your Synology and restart the Crashplan package."
# now it's time to (re)start crashplan and make sure it upgraded
echo "Once you have confirmed the upgrade is successful, add the following"
echo "headless key to your .ui_info file:"
echo -n " "
cat /var/lib/crashplan/.ui_info ; echo
echo
echo "For more details, see the original instructions here:"
echo "http://chrisnelson.ca/2015/07/02/fixing-crashplan-4-3-0-on-synology/"
}
@muddman
Copy link

muddman commented Dec 8, 2015

thanks for providing this -- it is very helpful seeing as these upgrade happen all the time!!

@bartn
Copy link

bartn commented Dec 8, 2015

Thanks for this. How come you put it in a function wrapper?

Copy link

ghost commented Dec 9, 2015

Very cool! Two suggestions for future versions:

  • Frequently after a failed CrashPlan update in Synology there are tons of upgrade folders left which can cause issues with CrashPlan starting even after a successful upgrade via do_crashplan_upgrade, ideally all of those except the last one should be deleted.
  • If someone attempts to run via Synology ssh (e.g. source do_crashplan_upgrade.sh; do_crashplan_upgrade), they will get a syntax error on the function, presumably because there is no shebang line to define the shell?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment