1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rocketchat_ynh.git synced 2024-09-03 20:16:25 +02:00
rocketchat_ynh/scripts/upgrade
Selamanse 98b9c498b8
Fixes typo and struct in _common.sh (#36)
* Fixes typo and struct in _common.sh

* Fixes the success check

* Fix restore and upgrade

* Fixes python error msg

* Fixes python error msg
2017-11-27 21:45:46 +01:00

45 lines
1.4 KiB
Bash

#!/bin/bash
set -eu
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ./_common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
serviceuser=$(ynh_app_setting_get $app serviceuser)
path=$(ynh_app_setting_get $app path)
port=$(ynh_app_setting_get $app port)
sudo systemctl stop rocketchat
sudo rm -rf $final_path
sudo mkdir -p $final_path
# download and extract rocketchat
echo "Downloading rocket.chat-$ROCKETCHAT_VERSION.gtar from https://download.rocket.chat/build/rocket.chat-${ROCKETCHAT_VERSION}.tgz."
sudo curl -s -L -o $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar "https://download.rocket.chat/build/rocket.chat-${ROCKETCHAT_VERSION}.tgz"
SHA_DOWNLOAD=$(sha256sum $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar | grep -o "^[a-f0-9]*")
if [[ ! "$SHA_DOWNLOAD" == "$ROCKETCHAT_SHASUM" ]]; then
ynh_die "The sha256sum does not match the configured one"
fi
sudo tar -xzf $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar -C $final_path --strip-components=1 bundle
sudo rm $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar
sudo chown -R $serviceuser: $final_path
cd $final_path/programs/server/
sudo npm install --production
sudo chown -R $serviceuser: $final_path
sudo systemctl start rocketchat
waitforservice