diff --git a/scripts/install b/scripts/install index 530c234..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.\ @@ -82,8 +85,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/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 \ 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