Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Seafile linux client update script
#!/bin/bash
# Create dirs if not exists
mkdir -p ~/bin ~/seaf-cli
cd ~/seaf-cli
# Remove any old or failed updates
rm -rf ~/seaf-cli/*.tar*
# Get download address
arch=$(uname -m | sed s/"_"/"-"/g)
regexp="http(s?):\/\/[^ \"\(\)\<\>]*seafile-cli_[\d\.\_]*$arch.tar.gz"
addr=`wget http://www.seafile.com/en/download/ -O - | grep --only-matching --perl-regexp "$regexp" | head -1`
wget $addr || (echo FAIL! No update address could be found && exit 1);
# Remove old version and cleanup some temp files
~/bin/seaf-cli stop
rm -rf ~/seafile-client/seafile-data/blocks
rm -rf ~/seaf-cli/seafile-cli-*/
# Installing the new version
tar -xf *.tar*
rm *.tar*
# Update symlink
rm ~/bin/seaf-cli
ln -s ~/seaf-cli/seafile-cli-*/seaf-cli ~/bin/seaf-cli
~/bin/seaf-cli start
cd -
echo Update completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.