Commit 4cea82c7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add seafile update script

parent f303136c
#!/bin/sh
VERSION="$1"
fatal()
{
echo "$@" >&2
exit 1
}
major()
{
echo "$1" | sed -e "s|\(.*\)\.[0-9]|\1|g"
}
minor()
{
echo "$1" | sed -e "s|.*\.\([0-9]\)|\1|g"
}
[ -n "$VERSION" ] || fatal "empty VERSION (run with version as arg)"
MAJOR="$(major $VERSION)"
PREV="$(readlink seafile-server-latest | sed -e "s|seafile-server-\(.*\)|\1|g")"
# "
PREVMAJOR="$(major $PREV)"
BMAJOR=$(major $MAJOR)
# check first version number
[ "$(major $PREVMAJOR)" = "$BMAJOR" ] || fatal "$PREVMAJOR != $MAJOR"
FIRSTSEQ=$(minor $PREVMAJOR)
LASTSEQ=$(minor $MAJOR)
[ -n "$MAJOR" ] || fatal "MAJOR is empty"
[ -n "$PREVMAJOR" ] || fatal "PREVMAJOR is empty"
#wget https://download.seadrive.org/seafile-server_${VERSION}_x86-64.tar.gz || fatal
#erc seafile-server_${VERSION}_x86-64.tar.gz || fatal
echo "Upgrade from $PREV to $VERSION ..."
serv monit stop
/etc/init.d/seafile stop
/etc/init.d/seahub stop
cd seafile-server-$VERSION/upgrade || fatal
if [ "$FIRSTSEQ" != "$LASTSEQ" ] ; then
for i in $(seq $FIRSTSEQ $(($LASTSEQ-1))) ; do
./upgrade_${BMAJOR}.${i}_${BMAJOR}.$(($i+1)).sh || fatal
done
fi
./minor-upgrade.sh || fatal
/etc/init.d/seafile start
/etc/init.d/seahub start
serv monit start
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment