1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/terraforming-mars_ynh.git synced 2024-09-03 20:36:05 +02:00
This commit is contained in:
Thomas 2023-12-13 18:57:01 +01:00 committed by GitHub
parent 5b290d5a3c
commit 838f6f16f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 13 deletions

View file

@ -10,6 +10,15 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_npm install --global npm@8.1.2
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================

View file

@ -21,6 +21,18 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# Upgrade NPM # Upgrade NPM
ynh_npm install --global npm@6.14.18 ynh_npm install --global npm@6.14.18
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -31,26 +43,19 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) # BUILD APP
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
cd $install_dir pushd $install_dir
ynh_secure_remove terraforming-mars
ynh_exec_warn_less git clone https://github.com/terraforming-mars/terraforming-mars.git
cd $install_dir/terraforming-mars
ynh_exec_warn_less git checkout $TM_version
pushd $install_dir/terraforming-mars
ynh_use_nodejs ynh_use_nodejs
ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18
ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm install --network-timeout=100000 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --save-dev @types/html-escaper
ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25
ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm run build SOURCE_VERSION="$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')"
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH SOURCE_VERSION="$SOURCE_VERSION" $ynh_npm run build
popd popd
chmod 750 "$install_dir" chmod 750 "$install_dir"