Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ibksturm/82de49ecd6f1df759a242e7417736886 to your computer and use it in GitHub Desktop.
Save ibksturm/82de49ecd6f1df759a242e7417736886 to your computer and use it in GitHub Desktop.
Installs Synology Drive on Fedora 29 (from the .deb package). Use at own risk.
#!/usr/bin/env bash
if [[ $UID != 0 ]];
then
echo "Please run this script with sudo or as root:"
echo
echo "sudo $0 $*"
exit 1 || return 1
fi
read -p "This script will remove and re-create a directory called ./synology-drive\n, ok? [y/n]" -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
echo
rm -rf ./synology-drive
mkdir ./synology-drive
cd ./synology-drive
mkdir -p ./tar/control
mkdir -p ./tar/data
ar x $(find .. -name "synology-drive*.deb" -print -quit)
tar -C ./tar/control -zxvf control.tar.gz | sed 's/.*/Extracting control.tar.gz | &/'
tar -C ./tar/data -xvf data.tar.xz | sed 's/.*/Extracting data.tar.xz | &/'
echo "Pre-install scripts running, assuming no earlier versions are installed."
echo "If this assumption is incorrect, please revise this script :)"
./tar/control/preinst install
if [[ $? != 0 ]];
then
echo "preinst install failed. Cannot continue!"
exit 1 || return 1;
fi
cp -r ./tar/data/* /
if [[ $? != 0 ]];
then
echo "Error while copying new files. Please manually remove the following files if present."
find ./tar/data | cut -c11-
./tar/control/postrm abort-install
if [[ $? != 0 ]];
then
echo "postrm abort-install failed. Your system may be in a broken state. Do check!"
exit 1 || return 1
fi
fi
./tar/control/postinst configure 10570
echo "Should be done.."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment