summarylogtreecommitdiffstats
path: root/seahub-preupgrade
blob: 574b3b4f43957a6d78f0e468ea0a0a61bd1ff09d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env sh

if [ "$(basename $(pwd))" != "seafile-server" ]; then
	echo "Must be run from within a seafile server instance's 'seafile-server' subdirectory"
	exit 1
fi

echo "Please ensure that the seafile server is stopped, then press [ENTER] to proceed"
read

SEAFILE_VERSION="$(pacman -Qi seafile-server | grep Version | sed 's|[^\n]*: \(.*\)-.*|\1|g')"

echo "Preparing local seahub for upgrade..."

# Ensure newest upgrade scripts are available
rm -rf ./upgrade
cp -a /usr/share/seafile-server/scripts/upgrade ./
# Use python2
sed -i -e 's/python $seahub_secret_keygen/python2 $seahub_secret_keygen/g' upgrade/regenerate_secret_key.sh
# Ready old seahub version
rm -rf seahub-old
mv seahub seahub-old

# Ready new seahub version
curl -fLC - --retry 3 --retry-delay 3 -O "https://github.com/haiwen/seahub/archive/v${SEAFILE_VERSION}-server.tar.gz"
tar -xzf v${SEAFILE_VERSION}-server.tar.gz
mv "seahub-${SEAFILE_VERSION}-server" seahub

echo "Done, you should now execute the appropriate upgrade script by calling './upgrade/SCRIPT'."