Created
January 5, 2019 03:40
-
-
Save JochemKuijpers/aa8977ddec53967e86f8e09559d8798a to your computer and use it in GitHub Desktop.
Installs Synology Drive on Fedora 29 (from the .deb package). Use at own risk.
This file contains 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
#!/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
Thank you very much! You really saved my ass with this code 🥇