diff --git a/.gitignore b/.gitignore index 783a4ae..8f144f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.sw[op] +.DS_Store diff --git a/conf/systemd.service b/conf/systemd.service index 1343913..7c01125 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -Environment=__YNH_NODE_LOAD_PATH__ +Environment=PATH=__PATH_WITH_NODEJS__ WorkingDirectory=__INSTALL_DIR__/ ExecStart=yarn run next start -p __PORT__ diff --git a/manifest.toml b/manifest.toml index 97b5065..5925ac0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,7 +15,8 @@ demo = "https://lingva.ml" code = "https://github.com/thedaviddelta/lingva-translate" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = false diff --git a/scripts/_common.sh b/scripts/_common.sh index 9195d57..e3290b0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,19 +1,7 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= nodejs_version=18 - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index 7189d8c..1d549d0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,31 +1,22 @@ #!/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 -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP @@ -33,10 +24,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index c3278ea..33129ca 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,39 +1,31 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="stop" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # CHANGE THE URL IN .ENV.LOCAL AND REBUILD THE APP #================================================= -ynh_script_progression --message="Setting the new URL..." --weight=1 +ynh_script_progression "Setting the new URL..." if [ $change_domain -eq 1 ] then - ynh_replace_string --match_string="NEXT_PUBLIC_SITE_DOMAIN=$old_domain$old_path" --replace_string="NEXT_PUBLIC_SITE_DOMAIN=$new_domain$new_path" --target_file="$install_dir/.env.local" + ynh_replace --match="NEXT_PUBLIC_SITE_DOMAIN=$old_domain$old_path" --replace="NEXT_PUBLIC_SITE_DOMAIN=$new_domain$new_path" --file="$install_dir/.env.local" fi if [ $change_path -eq 1 ] @@ -52,45 +44,42 @@ then next_path=$new_path fi - ynh_add_config --template="manifest.json" --destination="$install_dir/public/manifest.json" + ynh_config_add --template="manifest.json" --destination="$install_dir/public/manifest.json" - ynh_add_config --template="next.config.js" --destination="$install_dir/next.config.js" + ynh_config_add --template="next.config.js" --destination="$install_dir/next.config.js" - ynh_replace_string --match_string="src={useColorModeValue(\"$old_next_path/banner_light.svg\", \"$old_next_path/banner_dark.svg\")}" --replace_string="src={useColorModeValue(\"$new_next_path/banner_light.svg\", \"$new_next_path/banner_dark.svg\")}" --target_file="$install_dir/components/Header.tsx" + ynh_replace --match="src={useColorModeValue(\"$old_next_path/banner_light.svg\", \"$old_next_path/banner_dark.svg\")}" --replace="src={useColorModeValue(\"$new_next_path/banner_light.svg\", \"$new_next_path/banner_dark.svg\")}" --file="$install_dir/components/Header.tsx" - ynh_replace_string --match_string="href=\"$old_next_path/favicon" --replace_string="href=\"$new_next_path/favicon" --target_file="$install_dir/components/CustomHead.tsx" + ynh_replace --match="href=\"$old_next_path/favicon" --replace="href=\"$new_next_path/favicon" --file="$install_dir/components/CustomHead.tsx" - ynh_replace_string --match_string="href=\"$old_next_path/apple" --replace_string="href=\"$new_next_path/apple" --target_file="$install_dir/components/CustomHead.tsx" + ynh_replace --match="href=\"$old_next_path/apple" --replace="href=\"$new_next_path/apple" --file="$install_dir/components/CustomHead.tsx" - ynh_replace_string --match_string="href=\"$old_next_path/manifest" --replace_string="href=\"$new_next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx" + ynh_replace --match="href=\"$old_next_path/manifest" --replace="href=\"$new_next_path/manifest" --file="$install_dir/components/CustomHead.tsx" fi chown $app:www-data "$install_dir/public/manifest.json" -chown $app:www-data "$install_dir/next.config.js" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:www-data "$install_dir/next.config.js" chmod 664 "$install_dir/public/manifest.json" -chmod 664 "$install_dir/next.config.js" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 664 "$install_dir/next.config.js" #================================================= # REBUILDING AND INSTALL THE APP #================================================= -ynh_script_progression --message="Rebuilding the app..." --weight=1 +ynh_script_progression "Rebuilding the app..." -ynh_use_nodejs -ynh_exec_warn_less yarn --cwd "$install_dir" build +ynh_hide_warnings yarn --cwd "$install_dir" build chown -R $app:$app "$install_dir/.next" -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index a27b2af..16306cb 100755 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -14,39 +8,38 @@ source /usr/share/yunohost/helpers #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated NGINX config using the conf/nginx.conf template -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # APP INITIAL CONFIGURATION #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression "Adding $app's configuration..." -ynh_add_config --template=".env.local" --destination="$install_dir/.env.local" +ynh_config_add --template=".env.local" --destination="$install_dir/.env.local" -chmod 400 "$install_dir/.env.local" -chown $app:$app "$install_dir/.env.local" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env.local" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env.local" #================================================= # CONFIGURATION FOR SUBPATH #================================================= -ynh_secure_remove --file="$install_dir/public/manifest.json" -ynh_secure_remove --file="$install_dir/next.config.js" +ynh_safe_rm "$install_dir/public/manifest.json" +ynh_safe_rm "$install_dir/next.config.js" if [ "$path" = "/" ]; then next_path="" @@ -54,53 +47,51 @@ else next_path=$path fi -ynh_add_config --template="manifest.json" --destination="$install_dir/public/manifest.json" +ynh_config_add --template="manifest.json" --destination="$install_dir/public/manifest.json" -ynh_add_config --template="next.config.js" --destination="$install_dir/next.config.js" +ynh_config_add --template="next.config.js" --destination="$install_dir/next.config.js" -ynh_replace_string --match_string="src={useColorModeValue(\"/banner_light.svg\", \"/banner_dark.svg\")}" --replace_string="src={useColorModeValue(\"$next_path/banner_light.svg\", \"$next_path/banner_dark.svg\")}" --target_file="$install_dir/components/Header.tsx" +ynh_replace --match="src={useColorModeValue(\"/banner_light.svg\", \"/banner_dark.svg\")}" --replace="src={useColorModeValue(\"$next_path/banner_light.svg\", \"$next_path/banner_dark.svg\")}" --file="$install_dir/components/Header.tsx" -ynh_replace_string --match_string="href=\"/favicon" --replace_string="href=\"$next_path/favicon" --target_file="$install_dir/components/CustomHead.tsx" +ynh_replace --match="href=\"/favicon" --replace="href=\"$next_path/favicon" --file="$install_dir/components/CustomHead.tsx" -ynh_replace_string --match_string="href=\"/apple" --replace_string="href=\"$next_path/apple" --target_file="$install_dir/components/CustomHead.tsx" +ynh_replace --match="href=\"/apple" --replace="href=\"$next_path/apple" --file="$install_dir/components/CustomHead.tsx" -ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx" +ynh_replace --match="href=\"/manifest" --replace="href=\"$next_path/manifest" --file="$install_dir/components/CustomHead.tsx" chown $app:www-data "$install_dir/public/manifest.json" -chown $app:www-data "$install_dir/next.config.js" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:www-data "$install_dir/next.config.js" chmod 664 "$install_dir/public/manifest.json" -chmod 664 "$install_dir/next.config.js" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 664 "$install_dir/next.config.js" #================================================= # BUILD AND INSTALL THE APP #================================================= -ynh_script_progression --message="Building the app..." --weight=1 +ynh_script_progression "Building the app..." + +ynh_nodejs_install -ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_use_nodejs yarn config set enableTelemetry 0 -ynh_exec_warn_less yarn --cwd "$install_dir" install +ynh_hide_warnings yarn --cwd "$install_dir" install yarn --cwd "$install_dir" run next telemetry disable -ynh_exec_warn_less yarn --cwd "$install_dir" build +ynh_hide_warnings yarn --cwd "$install_dir" build chown -R $app:$app "$install_dir/node_modules" chown -R $app:$app "$install_dir/.next" -#================================================= -# GENERIC FINALIZATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add $app --description="alternative to google translate" --log="/var/log/$app/$app.log" # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index eedb785..693b864 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,36 +1,31 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE +# REMOVE SYSTEMD SERVICE + #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null +if ynh_hide_warnings yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=1 + ynh_script_progression "Removing $app service integration..." yunohost service remove $app fi -ynh_remove_systemd_config +ynh_config_remove_systemd -ynh_remove_nginx_config +ynh_config_remove_nginx -ynh_secure_remove --file="/var/log/$app/$app.log" +#REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app/$app.log" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index d42d22e..e360d5c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,54 +1,44 @@ #!/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 # starting nodejs for fresh install -ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_use_nodejs +ynh_nodejs_install #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chown -R $app:www-data "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore "/etc/systemd/system/$app.service" systemctl enable $app.service --quiet yunohost service add $app --description="alternative to google translate" --log="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 879156d..3736680 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,22 +1,14 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="stop" #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) @@ -24,42 +16,42 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] +# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed +if ynh_app_upstream_version_changed then - ynh_script_progression --message="Upgrading source files..." --weight=1 + ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" fi -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." # Create a dedicated NGINX config using the conf/nginx.conf template -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 +ynh_script_progression "Updating configuration..." -ynh_add_config --template=".env.local" --destination="$install_dir/.env.local" +ynh_config_add --template=".env.local" --destination="$install_dir/.env.local" -chmod 400 "$install_dir/.env.local" -chown $app:$app "$install_dir/.env.local" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env.local" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env.local" #================================================= # CONFIGURATION FOR SUBPATH #================================================= -ynh_secure_remove --file="$install_dir/public/manifest.json" -ynh_secure_remove --file="$install_dir/next.config.js" +ynh_safe_rm "$install_dir/public/manifest.json" +ynh_safe_rm "$install_dir/next.config.js" if [ "$path" = "/" ]; then next_path="" @@ -67,31 +59,30 @@ else next_path=$path fi -ynh_add_config --template="manifest.json" --destination="$install_dir/public/manifest.json" +ynh_config_add --template="manifest.json" --destination="$install_dir/public/manifest.json" -ynh_add_config --template="next.config.js" --destination="$install_dir/next.config.js" +ynh_config_add --template="next.config.js" --destination="$install_dir/next.config.js" -ynh_replace_string --match_string="src={useColorModeValue(\"/banner_light.svg\", \"/banner_dark.svg\")}" --replace_string="src={useColorModeValue(\"$next_path/banner_light.svg\", \"$next_path/banner_dark.svg\")}" --target_file="$install_dir/components/Header.tsx" +ynh_replace --match="src={useColorModeValue(\"/banner_light.svg\", \"/banner_dark.svg\")}" --replace="src={useColorModeValue(\"$next_path/banner_light.svg\", \"$next_path/banner_dark.svg\")}" --file="$install_dir/components/Header.tsx" -ynh_replace_string --match_string="href=\"/favicon" --replace_string="href=\"$next_path/favicon" --target_file="$install_dir/components/CustomHead.tsx" +ynh_replace --match="href=\"/favicon" --replace="href=\"$next_path/favicon" --file="$install_dir/components/CustomHead.tsx" -ynh_replace_string --match_string="href=\"/apple" --replace_string="href=\"$next_path/apple" --target_file="$install_dir/components/CustomHead.tsx" +ynh_replace --match="href=\"/apple" --replace="href=\"$next_path/apple" --file="$install_dir/components/CustomHead.tsx" -ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx" +ynh_replace --match="href=\"/manifest" --replace="href=\"$next_path/manifest" --file="$install_dir/components/CustomHead.tsx" chown $app:www-data "$install_dir/public/manifest.json" -chown $app:www-data "$install_dir/next.config.js" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:www-data "$install_dir/next.config.js" chmod 664 "$install_dir/public/manifest.json" -chmod 664 "$install_dir/next.config.js" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 664 "$install_dir/next.config.js" #================================================= # REBUILD AND INSTALL THE APP #================================================= -ynh_script_progression --message="Rebuilding the app..." --weight=1 +ynh_script_progression "Rebuilding the app..." -ynh_use_nodejs -ynh_exec_warn_less yarn --cwd "$install_dir" install -ynh_exec_warn_less yarn --cwd "$install_dir" build +ynh_hide_warnings yarn --cwd "$install_dir" install +ynh_hide_warnings yarn --cwd "$install_dir" build chown -R $app:$app "$install_dir/node_modules" chown -R $app:$app "$install_dir/.next" @@ -99,17 +90,17 @@ chown -R $app:$app "$install_dir/.next" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." # Create a dedicated systemd config -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add $app --description="alternative to google translate" --log="/var/log/$app/$app.log" -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"