From 156a0263be02873ffd15c38e7d222036db553bc3 Mon Sep 17 00:00:00 2001 From: Selamanse Date: Sat, 2 Feb 2019 22:44:03 +0100 Subject: [PATCH] Use new helpers and restrict arch --- conf/app.src | 7 +++++++ scripts/install | 23 ++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..73df31e --- /dev/null +++ b/conf/app.src @@ -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 \ No newline at end of file diff --git a/scripts/install b/scripts/install index 11073e0..9296b23 100644 --- a/scripts/install +++ b/scripts/install @@ -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