diff --git a/manifest.json b/manifest.json index 9e5c2af..568a077 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Simple and user-friendly photo gallery that's made for photographers ", "fr": "Galerie photos simple et facile à utiliser, faite pour les photographes" }, - "version": "2.3.9~ynh1", + "version": "2.3.9~ynh2", "url": "https://photoview.github.io/", "license": "AGPL-3.0-only", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 7f725f2..78dbcc8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,6 +15,11 @@ fi # PERSONAL HELPERS #================================================= +function install_dependencies { + ynh_install_app_dependencies $pkg_dependencies + ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +} + function setup_sources { ynh_secure_remove "$final_path" ynh_setup_source --dest_dir="$final_path" @@ -81,13 +86,13 @@ function build_ui { ynh_replace_string -m "cd .. && " -r "" -f "$ui_path/package.json" pushd "$ui_path" || ynh_die - chown -R $app:$app $final_path - sudo -u $app touch $ui_path/.yarnrc - sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" import 2>&1 - sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" add husky 2>&1 - sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" install 2>&1 - sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" add graphql --ignore-engines 2>&1 - sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" run build --public-url "$path_url" 2>&1 + chown -R $app:$app $final_path + sudo -u $app touch $ui_path/.yarnrc + sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" import 2>&1 + sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" add husky 2>&1 + sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" install 2>&1 + sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" add graphql --ignore-engines 2>&1 + sudo -u $app env "PATH=$node_path" yarn --cache-folder "$ui_path/yarn-cache" --use-yarnrc "$ui_path/.yarnrc" run build --public-url "$path_url" 2>&1 popd || ynh_die cp -rT "$final_path/ui/build" "$final_path/output/ui" @@ -97,7 +102,7 @@ function build_ui { function set_node_vars { nodejs_version=$(ynh_app_setting_get --app=$app --key=nodejs_version) - if [ $nodejs_version -ne 16 ]; then + if [ $nodejs_version -ne 16 ]; then ynh_exec_warn_less ynh_remove_nodejs fi ynh_exec_warn_less ynh_install_nodejs --nodejs_version=16 diff --git a/scripts/backup b/scripts/backup index 90b2e5e..c4a4396 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +ynh_clean_setup() { true } # Exit if an error occurs during the execution of the script @@ -80,7 +80,7 @@ ynh_backup --src_path="/var/log/$app" #================================================= ynh_print_info --message="Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_mysql_dump_db --database="$db_name" >db.sql #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index 70064a4..448926b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -46,7 +46,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma # Backup the current version of the app ynh_backup_before_upgrade -ynh_clean_setup () { +ynh_clean_setup() { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" @@ -61,8 +61,7 @@ ynh_abort_if_errors #================================================= change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then +if [ "$old_domain" != "$new_domain" ]; then change_domain=1 fi @@ -85,8 +84,7 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the domain for NGINX -if [ $change_domain -eq 1 ] -then +if [ $change_domain -eq 1 ]; then # Delete file checksum for the old conf file location ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf diff --git a/scripts/install b/scripts/install index be972c9..8fed52e 100755 --- a/scripts/install +++ b/scripts/install @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +ynh_clean_setup() { true } # Exit if an error occurs during the execution of the script @@ -69,8 +69,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=60 -ynh_install_app_dependencies $pkg_dependencies -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +install_dependencies #================================================= # CREATE DEDICATED USER @@ -178,8 +177,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary -if [ $is_public -eq 1 ] -then +if [ $is_public -eq 1 ]; then # Everyone can access the app. # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" diff --git a/scripts/remove b/scripts/remove index f023cca..ea82bfa 100755 --- a/scripts/remove +++ b/scripts/remove @@ -43,7 +43,7 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config - +I #================================================= # REMOVE THE MYSQL DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index bac7bb0..96c7095 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +ynh_clean_setup() { true } # Exit if an error occurs during the execution of the script @@ -42,10 +42,10 @@ mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +ynh_webpath_available --domain=$domain --path_url=$path_url || + ynh_die --message="Path not available: ${domain}${path_url}" +test ! -d $final_path || + ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -70,7 +70,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" ynh_script_progression --message="Reinstalling dependencies..." --weight=30 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +install_dependencies #================================================= # RESTORE THE APP MAIN DIR @@ -100,7 +100,7 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1 db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name <./db.sql #================================================= # RESTORE GO diff --git a/scripts/upgrade b/scripts/upgrade index 2f4c717..8f98769 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,7 +39,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade -ynh_clean_setup () { +ynh_clean_setup() { # Restore it if the upgrade fails ynh_restore_upgradebackup } @@ -68,14 +68,13 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +install_dependencies #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] -then +if [ "$upgrade_type" == "UPGRADE_APP" ]; then ynh_script_progression --message="Upgrading source files..." --weight=5 setup_sources @@ -122,7 +121,7 @@ fi ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config -ynh_add_systemd_config --service=$app +ynh_add_systemd_config --service=$app #================================================= # UPDATE A CONFIG FILE