update upgrade script for recent changes
changes accounted for - the tar directory structure had changed to use a subdirectory - there are now multiple linux targets released bugs - the service must be stopped before replacing the binary - migrations were not being run during an upgrade
This commit is contained in:
parent
b9914dd65a
commit
2c075c0347
1 changed files with 15 additions and 3 deletions
|
@ -31,7 +31,7 @@ fi
|
||||||
# go ahead and check for the latest release on linux
|
# go ahead and check for the latest release on linux
|
||||||
echo "Checking for updates..."
|
echo "Checking for updates..."
|
||||||
|
|
||||||
url=`curl -s https://api.github.com/repos/writeas/writefreely/releases/latest | grep 'browser_' | grep linux | cut -d\" -f4`
|
url=`curl -s https://api.github.com/repos/writeas/writefreely/releases/latest | grep 'browser_' | grep 'linux' | grep 'amd64' | cut -d\" -f4`
|
||||||
|
|
||||||
# check current version
|
# check current version
|
||||||
|
|
||||||
|
@ -82,13 +82,25 @@ filename=${parts[-1]}
|
||||||
echo "Extracting files..."
|
echo "Extracting files..."
|
||||||
tar -zxf $tempdir/$filename -C $tempdir
|
tar -zxf $tempdir/$filename -C $tempdir
|
||||||
|
|
||||||
|
# stop service
|
||||||
|
echo "Stopping writefreely systemd service..."
|
||||||
|
if `systemctl start writefreely`; then
|
||||||
|
echo "Success, service stopped."
|
||||||
|
else
|
||||||
|
echo "Upgrade failed to stop the systemd service, exiting early."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# copy files
|
# copy files
|
||||||
echo "Copying files..."
|
echo "Copying files..."
|
||||||
cp -r $tempdir/{pages,static,templates,writefreely} .
|
cp -r $tempdir/writefreely/{pages,static,templates,writefreely} .
|
||||||
|
|
||||||
|
# migrate db
|
||||||
|
./writefreely -migrate
|
||||||
|
|
||||||
# restart service
|
# restart service
|
||||||
echo "Restarting writefreely systemd service..."
|
echo "Restarting writefreely systemd service..."
|
||||||
if `systemctl restart writefreely`; then
|
if `systemctl start writefreely`; then
|
||||||
echo "Success, version has been upgraded to $latest."
|
echo "Success, version has been upgraded to $latest."
|
||||||
else
|
else
|
||||||
echo "Upgrade complete, but failed to restart service."
|
echo "Upgrade complete, but failed to restart service."
|
||||||
|
|
Loading…
Add table
Reference in a new issue