1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/thelounge_ynh.git synced 2024-09-03 20:35:54 +02:00
This commit is contained in:
ericgaspar 2021-07-02 21:50:21 +02:00
parent a65557e3ac
commit 3c8cd2d9e2
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 32 additions and 15 deletions

View file

@ -13,6 +13,11 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
@ -37,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP CONFIG
#=================================================
ynh_backup --src_path="$config_path" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
@ -49,12 +60,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP CONFIG
#=================================================
ynh_backup --src_path="$config_path"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -111,12 +111,20 @@ ynh_app_setting_set --app=$app --key=$config_path --value=$config_path
mkdir -p $config_path
ynh_add_config --template="../conf/config.js" --destination="$config_path/config.js"
chmod 750 "$config_path"
chmod -R o-rwx "$config_path"
chown -R $app:www-data "$config_path"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/config.js" --destination="$config_path/config.js"
chmod 400 "$config_path/config.js"
chown $app "$config_path/config.js"
#=================================================
# INSTALL THE LOUNGE
#=================================================
@ -124,7 +132,7 @@ ynh_script_progression --message="Installing The Lounge..."
pushd $final_path
ynh_use_nodejs
yarn install
ynh_exec_warn_less yarn install
ynh_exec_warn_less NODE_ENV=production yarn build
popd
@ -134,7 +142,6 @@ popd
ynh_script_progression --message="Configuring a systemd service..."
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__NODE__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
ynh_add_systemd_config

View file

@ -14,7 +14,8 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
#### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -61,7 +62,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring $app main directory..."
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
@ -74,7 +75,9 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Restoring the config path..."
ynh_restore_file --origin_path="$config_path"
ynh_restore_file --origin_path="$config_path" --not_mandatory
mkdir -p $config_path
chmod 750 "$config_path"
chmod -R o-rwx "$config_path"

View file

@ -134,7 +134,7 @@ then
ynh_script_progression --message="Upgrading the lounge..."
pushd $final_path
ynh_use_nodejs
yarn install
ynh_exec_warn_less yarn install
ynh_exec_warn_less NODE_ENV=production yarn build
popd
fi
@ -146,13 +146,15 @@ ynh_script_progression --message="Modifying a config file..."
ynh_add_config --template="../conf/config.js" --destination="$config_path/config.js"
chmod 400 "$config_path/config.js"
chown $app "$config_path/config.js"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__NODE__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
ynh_add_systemd_config