mirror of
https://github.com/YunoHost-Apps/framagames_ynh.git
synced 2024-09-03 18:36:28 +02:00
Update scripts
This commit is contained in:
parent
15dcb5c3d9
commit
b121afbfda
6 changed files with 70 additions and 32 deletions
|
@ -10,6 +10,29 @@ nodejs_version=12
|
|||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
_configure_framagames() {
|
||||
ynh_replace_string --target_file="$install_dir/sources/src/data/main.yml" \
|
||||
--match_string="canonical: .*" \
|
||||
--replace_string="canonical: https://$domain$path"
|
||||
|
||||
ynh_replace_string --target_file="$install_dir/sources/config/env.js" \
|
||||
--match_string=": '/'," \
|
||||
--replace_string=": '$path/',"
|
||||
}
|
||||
|
||||
_build_install_framagames() {
|
||||
pushd "$install_dir/sources"
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run commons
|
||||
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run prod
|
||||
popd
|
||||
|
||||
mv -f "$install_dir/sources/dist" "$install_dir/www"
|
||||
mv -f "$install_dir/sources/games/"* "$install_dir/www"
|
||||
cp "$install_dir/www/fr/index.html" "$install_dir/www/index.html"
|
||||
# cd public && for f in $(find -type l);do cp --remove-destination $(readlink -f $f) $f;done;
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -25,12 +25,6 @@ ynh_backup --src_path="$install_dir"
|
|||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -14,6 +14,20 @@ ynh_script_progression --message="Updating NGINX web server configuration..."
|
|||
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring $app..."
|
||||
|
||||
_configure_framagames
|
||||
|
||||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building $app..."
|
||||
|
||||
_build_install_framagames
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -30,29 +30,14 @@ chown -R "$app:www-data" "$install_dir"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring $app..."
|
||||
|
||||
ynh_replace_string --target_file="$install_dir/sources/src/data/main.yml" \
|
||||
--match_string="canonical: .*" \
|
||||
--replace_string="canonical: https://$domain$path"
|
||||
|
||||
ynh_replace_string --target_file="$install_dir/sources/config/env.js" \
|
||||
--match_string=": '/'," \
|
||||
--replace_string=": '$path/',"
|
||||
_configure_framagames
|
||||
|
||||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building $app..."
|
||||
|
||||
pushd "$install_dir/sources"
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run commons
|
||||
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run prod
|
||||
popd
|
||||
|
||||
mv -f "$install_dir/sources/dist" "$install_dir/www"
|
||||
mv -f "$install_dir/sources/games/"* "$install_dir/www"
|
||||
cp "$install_dir/www/fr/index.html" "$install_dir/www/index.html"
|
||||
# cd public && for f in $(find -type l);do cp --remove-destination $(readlink -f $f) $f;done;
|
||||
_build_install_framagames
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# INSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring NodeJS..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -16,15 +23,13 @@ ynh_script_progression --message="Restoring the app main directory..."
|
|||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
|
@ -32,7 +37,6 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# INSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NodeJS..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -16,15 +23,26 @@ ynh_script_progression --message="Upgrading source files..."
|
|||
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
# CONFIGURE APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
ynh_script_progression --message="Configuring $app..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
_configure_framagames
|
||||
|
||||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building $app..."
|
||||
|
||||
_build_install_framagames
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
|
Loading…
Reference in a new issue