|
|
|
@ -11,7 +11,7 @@ |
|
|
|
|
## have not installed the binary `writefreely` in another location. ## |
|
|
|
|
############################################################################### |
|
|
|
|
# |
|
|
|
|
# Copyright © 2019 A Bunch Tell LLC. |
|
|
|
|
# Copyright © 2019-2020 A Bunch Tell LLC. |
|
|
|
|
# |
|
|
|
|
# This file is part of WriteFreely. |
|
|
|
|
# |
|
|
|
@ -31,7 +31,7 @@ fi |
|
|
|
|
# go ahead and check for the latest release on linux |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
@ -82,13 +82,25 @@ filename=${parts[-1]} |
|
|
|
|
echo "Extracting files..." |
|
|
|
|
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 |
|
|
|
|
echo "Copying files..." |
|
|
|
|
cp -r $tempdir/{pages,static,templates,writefreely} . |
|
|
|
|
cp -r $tempdir/writefreely/{pages,static,templates,writefreely} . |
|
|
|
|
|
|
|
|
|
# migrate db |
|
|
|
|
./writefreely -migrate |
|
|
|
|
|
|
|
|
|
# restart service |
|
|
|
|
echo "Restarting writefreely systemd service..." |
|
|
|
|
if `systemctl restart writefreely`; then |
|
|
|
|
echo "Starting writefreely systemd service..." |
|
|
|
|
if `systemctl start writefreely`; then |
|
|
|
|
echo "Success, version has been upgraded to $latest." |
|
|
|
|
else |
|
|
|
|
echo "Upgrade complete, but failed to restart service." |
|
|
|
|