1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wetty_ynh.git synced 2024-09-03 18:16:29 +02:00

Cleanup scripts, add checks for automatic variables

This commit is contained in:
Félix Piédallu 2020-07-01 10:15:20 +02:00
parent 4ab7265e89
commit 94e407e0fb
6 changed files with 10 additions and 10 deletions

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies=""
# pkg_dependencies=""
YNH_NODEJS_VERSION=10

View file

@ -28,7 +28,6 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
port=$(ynh_app_setting_get --app="$app" --key=port)
@ -110,7 +109,7 @@ ynh_script_progression --message="Rebuilding yarn dependencies..." --weight=2
chown -R "$app":"$app" "$final_path"
pushd "$final_path" || return 1
ynh_use_nodejs
ynh_use_nodejs ; set "${ynh_node_load_PATH:?}"
sudo -u "$app" env "$ynh_node_load_PATH" yarn global add wetty
yarn_bin_dir="$(sudo -u "$app" env "$ynh_node_load_PATH" yarn global bin)"
popd || return 1
@ -133,6 +132,7 @@ path_url="$new_path"
# Create a dedicated systemd config
ynh_backup_if_checksum_is_different --file="/etc/systemd/system/$app.service"
ynh_remove_systemd_config
test -n "${domain}${port}${path_url}${ynh_node_load_PATH}${yarn_bin_dir}"
ynh_add_systemd_config --others_var="domain port path_url ynh_node_load_PATH yarn_bin_dir"
ynh_store_file_checksum --file="/etc/systemd/system/$app.service"

View file

@ -67,7 +67,7 @@ ynh_app_setting_set --app="$app" --key=port --value="$port"
ynh_script_progression --message="Installing dependencies..." --weight=6
# Install nodejs
ynh_install_nodejs --nodejs_version=$YNH_NODEJS_VERSION
ynh_install_nodejs --nodejs_version="$YNH_NODEJS_VERSION"
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" \
@ -108,7 +108,7 @@ ynh_script_progression --message="Building yarn dependencies... This may take se
chown -R "$app":"$app" "$final_path"
pushd "$final_path" || return 1
ynh_use_nodejs
ynh_use_nodejs ; set "${ynh_node_load_PATH:?}"
sudo -u "$app" env "$ynh_node_load_PATH" yarn global add wetty
yarn_bin_dir="$(sudo -u "$app" env "$ynh_node_load_PATH" yarn global bin)"
popd || return 1
@ -119,6 +119,7 @@ popd || return 1
ynh_script_progression --message="Configuring the systemd service..." --weight=1
# Create a dedicated systemd config
test -n "${domain}${port}${path_url}${ynh_node_load_PATH}${yarn_bin_dir}"
ynh_add_systemd_config --others_var="domain port path_url ynh_node_load_PATH yarn_bin_dir"
#=================================================

View file

@ -16,8 +16,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app="$app" --key=domain)
port=$(ynh_app_setting_get --app="$app" --key=port)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
#=================================================

View file

@ -79,7 +79,7 @@ chown -R root: "$final_path"
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
# Install nodejs
ynh_install_nodejs --nodejs_version=$YNH_NODEJS_VERSION
ynh_install_nodejs --nodejs_version="$YNH_NODEJS_VERSION"
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" \

View file

@ -95,7 +95,7 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$a
ynh_script_progression --message="Upgrading dependencies..." --time --weight=3
# Install nodejs
ynh_install_nodejs --nodejs_version=$YNH_NODEJS_VERSION
ynh_install_nodejs --nodejs_version="$YNH_NODEJS_VERSION"
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" \
@ -139,7 +139,7 @@ ynh_script_progression --message="Rebuilding yarn dependencies..." --weight=2
chown -R "$app":"$app" "$final_path"
pushd "$final_path" || return 1
ynh_use_nodejs
ynh_use_nodejs ; set "${ynh_node_load_PATH:?}"
sudo -u "$app" env "$ynh_node_load_PATH" yarn global add wetty
yarn_bin_dir="$(sudo -u "$app" env "$ynh_node_load_PATH" yarn global bin)"
popd || return 1
@ -150,6 +150,7 @@ popd || return 1
ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1
# Create a dedicated systemd config
test -n "${domain}${port}${path_url}${ynh_node_load_PATH}${yarn_bin_dir}"
ynh_add_systemd_config --others_var="domain port path_url ynh_node_load_PATH yarn_bin_dir"
#=================================================