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

51 lines
1.5 KiB
Bash

#!/bin/bash
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..."
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"
chown -R $app:www-data "$install_dir/_h5ai"
chmod 700 "$install_dir/_h5ai/private/conf"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last