aboutsummaryrefslogtreecommitdiff
path: root/scripts/upgrade
diff options
context:
space:
mode:
authornemsia <nemsia@nemsia.org>2017-05-28 17:16:45 +0200
committernemsia <nemsia@nemsia.org>2017-05-28 17:16:45 +0200
commit890b3f2328643801cf6d46fdb8ffc129739490f7 (patch)
tree0e31c6837f5815cee1e4752d8ab6ad59efa28b46 /scripts/upgrade
parentdc0d11084c85d5251474f5a971b16760b857d6a3 (diff)
parent097bd9dec81c64fe8830a8fe7863451056e13def (diff)
downloadmastodon_ynh-890b3f2328643801cf6d46fdb8ffc129739490f7.tar.gz
mastodon_ynh-890b3f2328643801cf6d46fdb8ffc129739490f7.tar.bz2
mastodon_ynh-890b3f2328643801cf6d46fdb8ffc129739490f7.zip
Merge remote-tracking branch 'refs/remotes/YunoHost-Apps/master'
Diffstat (limited to 'scripts/upgrade')
-rw-r--r--scripts/upgrade23
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/upgrade b/scripts/upgrade
index f070bbd..2a9b0fe 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -40,6 +40,14 @@ sudo systemctl stop mastodon-*.service
# Change owner of live folder
sudo chown -R $app: $final_path/live
+# upgrade Node.js v4 to v6
+node_version=$(nodejs --version)
+if [[ $node_version =~ ^v4.*$ ]]; then
+ pushd /opt
+ curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
+ sudo apt-get -y install nodejs
+fi
+
# Download Mastodon
sudo su - $app <<PULLCOMMANDS
pushd ~/live
@@ -50,11 +58,24 @@ PULLCOMMANDS
# Switch branch to tagged release
cd $final_path/live
+url=$(curl -s https://api.github.com/repos/tootsuite/mastodon/releases/latest | sort -r | head -1 | cut -d\" -f4)
+version=$(echo $url | cut -d/ -f8)
sudo su - $app <<SWITCHCOMMANDS
pushd ~/live
-git checkout $(git tag | tail -n 1)
+git checkout $version
SWITCHCOMMANDS
+# upgrade Node.js v4 to v6
+node_version=$(nodejs --version)
+if [[ $node_version =~ ^v4.*$ ]]; then
+ pushd /opt
+ curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
+ sudo apt-get -y install nodejs
+fi
+
+# add additional package for release 1.4
+ynh_package_install pkg-config libprotobuf-dev protobuf-compiler
+
# Apply Mastodon upgrade
sudo su - $app <<COMMANDS
pushd ~/live