1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/umami_ynh.git synced 2024-10-01 13:34:50 +02:00

Change the update script

This commit is contained in:
orhtej2 2023-09-22 23:39:11 +02:00
parent d04f678d84
commit f4dd1b9421

View file

@ -41,12 +41,12 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
if [ $(ynh_compare_current_package_version --comparison le --version 2.6.2~ynh4) ]; then
rm -rf "$install_dir/{*,.*}"
fi
if [[ "$upgrade_type" == "UPGRADE_APP" || $(ynh_compare_current_package_version --comparison le --version 2.6.2~ynh4) ]]; then
ynh_script_progression --message="Upgrading source files..." --weight=5
ynh_secure_remove --file="$install_dir/release"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/build" --full_replace=1 #--keep=".env"
fi
@ -92,13 +92,40 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --data
#=================================================
# CONFIGURE THE APP
#=================================================
ynh_script_progression --message="Configuring the app..." --weight=15
if [[ "$upgrade_type" == "UPGRADE_APP" || $(ynh_compare_current_package_version --comparison le --version 2.6.2~ynh4) ]]; then
ynh_script_progression --message="Configuring the app..." --weight=15
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NEXT_TELEMETRY_DISABLED=1 yarn build
# Actual app is a subset of release assets
# List of deps based on Dockerfile: https://github.com/umami-software/umami/blob/master/Dockerfile
ynh_secure_remove --file="node_modules/"
mv next.config.js .next/standalone/
mv public .next/standalone/
mv prisma .next/standalone/
mv scripts .next/standalone/
mv .next/static .next/standalone/.next
popd
ynh_secure_remove --file="$install_dir/release"
mkdir "$install_dir/release"
chmod -R o-rwx "$install_dir/release"
chown -R $app:www-data "$install_dir/release"
mv -f $install_dir/build/.next/standalone/* $install_dir/build/.next/standalone/.[!.]* $install_dir/release
pushd "$install_dir/release"
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn add npm-run-all dotenv prisma
popd
fi
rm -rf $install_dir/.cache
rm -rf $install_dir/build
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NEXT_TELEMETRY_DISABLED=1 yarn build
popd
#=================================================
# START SYSTEMD SERVICE