-
Notifications
You must be signed in to change notification settings - Fork 0
/
seafileUpdate
64 lines (52 loc) · 1.3 KB
/
seafileUpdate
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#Usage of this script: ./seafileUpdate.sh https://path-to-new-package.tar.gz
#exit on any error
set -e
#set initial path
workingDir="/home/seafile"
dlURL=$1
dlFileName=``
runUpgrade=``
cd $workingDir
#shutdown seafile-process
$workingDir/seafile-server-latest/seafile.sh stop
$workingDir/seafile-server-latest/seahub.sh stop
#echo "Seafile will be shut down"
echo "File Downloading"
#download file
if ! wget -o /dev/null $dlURL; then
echo 'Could not download file!'
exit 1
fi
dlFileName=`ls -t1 $workingDir | grep tar.gz | head -n1`
echo "File $dlFileName has been downloaded"
#extract file
echo "extract file $dlFileName"
tar -xzf "$dlFileName"
#get into upgrade-folder
seafDir=`ls -1t --g | grep seafile-server | head -1`
echo "get into $seafDir/upgrade"
cd $seafDir/upgrade
PS3='Please select the appropriate From... To... Upgradescript:'
QUIT="Quit_runUpdate.sh"
touch "$QUIT"
#get list of upgradescripts and offer list
select upgradeScript in *upgrade*.sh;
do
case $upgradeScript in
"$QUIT")
echo "Exiting."
break
;;
*)
echo "You picked $upgradeScript ($REPLY)"
#run upgradescript
./$upgradeScript
break
;;
esac
done
rm "$QUIT"
cd ~
$workingDir/seafile-server-latest/seafile.sh start
$workingDir/seafile-server-latest/seahub.sh start