1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rocketchat_ynh.git synced 2024-09-03 20:16:25 +02:00

Use new helpers and restrict arch

This commit is contained in:
Selamanse 2019-02-02 22:44:03 +01:00
parent 54e8f64bdd
commit 156a0263be
2 changed files with 21 additions and 9 deletions

7
conf/app.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=${ROCKETCHAT_DOWNLOAD_URI}
SOURCE_SUM=${ROCKETCHAT_SHASUM}
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=rocket.chat-${ROCKETCHAT_VERSION}.tgz
SOURCE_EXTRACT=true

View file

@ -30,6 +30,16 @@ app=$YNH_APP_INSTANCE_NAME
dbname=$app
serviceuser=rocketchat
#=================================================
# CHECK IF THE APP CAN BE INSTALLED
#=================================================
# Check for supported architecture
arch="$(uname -m)"
if [[ "$arch" != "x86_64" ]]; then
script_die "This app requires an x86_64 machine, but this one is '${arch}'."
fi
workdir=$(pwd)
# find suitable port (default 3000)
@ -102,16 +112,11 @@ sed -i "s@#DBNAME#@$dbname@g" ../conf/rocketchat_ldap.js
sudo cp ../conf/nginx.conf "$nginx_conf"
# download and extract rocketchat
echo "Downloading rocket.chat-$ROCKETCHAT_VERSION.gtar from ${ROCKETCHAT_DOWNLOAD_URI}."
sudo curl -s -L -o $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar "${ROCKETCHAT_DOWNLOAD_URI}"
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
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
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
ynh_setup_source "$final_path"
sudo chown -R $serviceuser: $final_path