Last active
October 6, 2020 18:52
-
-
Save elpatron68/801200c3ce03e19ba97abf2554ef1bd7 to your computer and use it in GitHub Desktop.
Update shell script for wiki.js (Linux install in ~/wiki)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Upgrade guide: https://docs.requarks.io/install/upgrade | |
# Prerequisite: Wiki.js installed in ~/wiki, this script saved in ~ | |
cd ~ | |
# Remove former downloaded file | |
rm wiki-js.tar.gz | |
rm ~/config.yml.bak | |
# Save config.yml | |
cp wiki/config.yml ~/config.yml.bak | |
# Get download url for latest version from Github API | |
LOCATION=$(curl -s https://api.github.com/repos/Requarks/wiki/releases/latest \ | |
| grep "tag_name" \ | |
| awk '{print "https://github.com/Requarks/wiki/releases/download/" substr($2, 2, length($2)-3) "/wiki-js.tar.gz"}') | |
# echo URL: $LOCATION | |
# Download latest version | |
wget -O wiki-js.tar.gz $LOCATION | |
# Stop wiki.js service | |
sudo systemctl stop wiki.service | |
# Extract archive | |
tar xzf wiki-js.tar.gz -C ./wiki | |
cd wiki | |
# Restore config.yml | |
cp ~/config.yml.bak ./config.yml | |
# Start wiki.js service | |
sudo systemctl start wiki.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment