From 5bf7d2bcd8873a6f82d62182ba24e136b12bf2c6 Mon Sep 17 00:00:00 2001 From: Selamanse Date: Tue, 31 Oct 2017 23:14:59 +0100 Subject: [PATCH 1/2] Fixes download locations --- scripts/install | 4 ++-- scripts/upgrade | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 530c234..3f3a88f 100644 --- a/scripts/install +++ b/scripts/install @@ -82,8 +82,8 @@ sed -i "s@#DESTDIR#@$final_path@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf "$nginx_conf" # download and extract rocketchat -echo "Downloading rocket.chat-$ROCKETCHAT_VERSION.gtar from https://rocket.chat/releases/${ROCKETCHAT_VERSION}/download." -sudo curl -s -L -o $final_path/rocket.chat-$ROCKETCHAT_VERSION.gtar "https://rocket.chat/releases/${ROCKETCHAT_VERSION}/download" +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" diff --git a/scripts/upgrade b/scripts/upgrade index 56c2668..1a37b64 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,7 @@ sudo rm -rf $final_path sudo mkdir -p $final_path # upgrade to the latest rocketchat -sudo curl -s -L -o $final_path/rocket.chat-latest.gtar "https://rocket.chat/releases/latest/download" +sudo curl -s -L -o $final_path/rocket.chat-latest.gtar "https://download.rocket.chat/stable" sudo tar -xzf $final_path/rocket.chat-latest.gtar -C $final_path --strip-components=1 bundle sudo rm $final_path/rocket.chat-latest.gtar From e5d29282754ccdd11d56aa978db0447736283d3c Mon Sep 17 00:00:00 2001 From: Selamanse Date: Tue, 31 Oct 2017 22:29:52 +0100 Subject: [PATCH 2/2] Fixes bad, legacy usage of domain/path check --- scripts/install | 5 ++++- scripts/restore | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 3f3a88f..f2cd182 100644 --- a/scripts/install +++ b/scripts/install @@ -35,11 +35,14 @@ workdir=$(pwd) port=$(ynh_find_port 3000) # Check domain/path availability -sudo yunohost app checkurl $domain -a $app +ynh_webpath_available $domain $path if [[ ! $? -eq 0 ]]; then ynh_die "domain not available" fi +# Register/book a web path for an app +ynh_webpath_register $app $domain $path + final_path="/var/lib/$app" [[ -d $final_path ]] && ynh_die \ "The destination directory '$final_path' already exists.\ diff --git a/scripts/restore b/scripts/restore index d92bfe7..e776f88 100644 --- a/scripts/restore +++ b/scripts/restore @@ -34,7 +34,13 @@ serviceuser=$(ynh_app_setting_get $app serviceuser) port=$(ynh_app_setting_get $app port) # Check domain/path availability -sudo yunohost app checkurl "${domain}${path}" -a "$app" || ynh_die +ynh_webpath_available $domain $path +if [[ ! $? -eq 0 ]]; then + ynh_die "domain not available" +fi + +# Register/book a web path for an app +ynh_webpath_register $app $domain $path # Check destination directory [[ -d $final_path ]] && ynh_die \