1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/h5ai_ynh.git synced 2024-09-03 20:36:25 +02:00

Build the app locally from git sources, using npm etc

This commit is contained in:
Alexandre Aubin 2024-05-12 20:36:20 +02:00
parent f01c5e692e
commit bbcce98055
6 changed files with 41 additions and 63 deletions

View file

@ -1,19 +1,3 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
# PHP APP SPECIFIC
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
nodejs_version="10.15"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,22 +9,8 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
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"
#=================================================

View file

@ -9,13 +9,28 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Install nodejs..."
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_script_progression --message="Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
tmpdir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmpdir"
pushd $tmpdir
npm ci
npm run build
mv build/_h5ai $install_dir/_h5ai
popd
ynh_secure_remove $tmpdir
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -24,7 +39,7 @@ chmod 700 "$install_dir/_h5ai/private/conf"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=3
ynh_script_progression --message="Adding system configurations related to $app..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,7 +9,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=4
ynh_restore_file --origin_path="$install_dir" --not_mandatory
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"

View file

@ -3,19 +3,30 @@
source _common.sh
source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Install nodejs..."
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="_h5ai/private/conf/options.json"
fi
ynh_script_progression --message="Setting up source files..."
tmpdir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmpdir"
pushd $tmpdir
cp $install_dir/_h5ai/private/conf/options.json ./options.json.bkp
npm ci
npm run build
ynh_secure_remove $install_dir/_h5ai
mv build/_h5ai $install_dir/_h5ai
cp ./options.json.bkp $install_dir/_h5ai/private/conf/options.json
popd
ynh_secure_remove $tmpdir
chmod o-rwx "$install_dir"
chown $app:www-data "$install_dir"