From 8f24e8a95a01b60f2188ef5035efa2c32f345ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 14 Jan 2024 13:12:24 +0100 Subject: [PATCH] fix --- manifest.toml | 23 ++----------------- scripts/_common.sh | 13 ----------- scripts/install | 18 --------------- scripts/remove | 5 ---- scripts/upgrade | 57 ++-------------------------------------------- tests.toml | 7 ------ 6 files changed, 4 insertions(+), 119 deletions(-) diff --git a/manifest.toml b/manifest.toml index 8c0f5b4..aea43bc 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,6 +34,7 @@ ram.build = "500M" ram.runtime = "100M" [install] + [install.domain] type = "domain" @@ -41,27 +42,7 @@ ram.runtime = "100M" type = "path" default = "/digiscreen" - [install.apikey_pixabay] - ask.en = "Your Pixabay API key" - ask.fr = "Votre clé d’API Pixabay" - help.en = "Optional: a Pixabay API key will let you chose a background by entering keywords." - help.fr = "Optionnel : une clé d’API Pixabay vous permettra de choisir un fond d’écran en entrant un mot clé." - type = "string" - example = "123456abc" - optional = true - - [install.apikey_google_youtube] - ask.en = "Your Google API key" - ask.fr = "Votre clé d’API Google" - help.en = "Optional: a Google API key will let you insert videos from YouTube on your Digiscreen" - help.fr = "Optionnel : une clé d’API Google vous permettra d’afficher des vidéos de YouTube sur votre Digiscreen." - type = "string" - example = "123456abc" - optional = true - [install.init_main_permission] - help.en = "If public, any visitor can use this app and thus will benefit from your API keys for Pixabay and YouTube." - help.fr = "Si l’application est publique, n’importe quel visiteur pourra utiliser cette application et bénéficiera donc de vos clés d’API pour Pixabay et YouTube." type = "group" default = "visitors" @@ -80,5 +61,5 @@ ram.runtime = "100M" [resources.ports] [resources.apt] - packages = ["php8.2-fpm"] + packages = "php8.2-sqlite3" diff --git a/scripts/_common.sh b/scripts/_common.sh index 09b0461..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,23 +4,10 @@ # COMMON VARIABLES #================================================= -nodejs_version="14" - #================================================= # PERSONAL HELPERS #================================================= -_digiscreen_build() { - pushd "$install_dir/sources" - echo "VUE_APP_PIXABAY_API_KEY=$apikey_pixabay" >> .env - echo "VUE_APP_GOOGLE_API_KEY=$apikey_google_youtube" >> .env - - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm run build - popd -} - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 7c6053f..cf216ee 100644 --- a/scripts/install +++ b/scripts/install @@ -9,31 +9,13 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# INSTALL NODEJS -#================================================= -ynh_script_progression --message="Installing NodeJS..." --weight 3 - -ynh_install_nodejs --nodejs_version="$nodejs_version" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/sources" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - -_digiscreen_build - -mv "$install_dir/sources/dist" "$install_dir/www" -ynh_secure_remove --file="$install_dir/sources" - -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" diff --git a/scripts/remove b/scripts/remove index b1a799f..ac762c0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -14,15 +14,10 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 -# Remove the dedicated NGINX config ynh_remove_nginx_config -# Remove the dedicated PHP-FPM config ynh_remove_fpm_config -# Remove the log files -ynh_secure_remove --file="/var/log/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 80875b6..cbaab26 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,65 +15,13 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# migrate camelCase to snake_case -if [[ -z "$apikey_pixabay" ]]; then - # migrate camelCase to snake_case - pixabay="$(ynh_app_setting_get --app="$app" --key=pixabay)" - apikey_pixabay="$pixabay" - ynh_app_setting_set --app="$app" --key="apikey_pixabay" --value="$apikey_pixabay" - ynh_app_setting_delete --app="$app" --key="pixabay" -fi - -if [[ -z "$apikey_google_youtube" ]]; then - googleYoutube="$(ynh_app_setting_get --app="$app" --key=googleYoutube)" - apikey_google_youtube="$googleYoutube" - ynh_app_setting_set --app="$app" --key="apikey_google_youtube" --value="$apikey_google_youtube" - ynh_app_setting_delete --app="$app" --key="googleYoutube" -fi - -#================================================= -# INSTALL NODEJS -#================================================= -ynh_script_progression --message="Installing NodeJS..." --weight 3 - -ynh_install_nodejs --nodejs_version="$nodejs_version" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 +ynh_setup_source --dest_dir="$install_dir" --keep="inc/digiwords.db" - ynh_setup_source --dest_dir="$install_dir/sources" - - _digiscreen_build - - # backup... - if [ -f "$install_dir/www/inc/digiwords.db" ]; then - mv "$install_dir/www/inc/digiwords.db" "$install_dir" - fi - - # upgrade... - ynh_secure_remove --file="$install_dir/www" - mv "$install_dir/sources/dist" "$install_dir/www" - - if [ -f "$install_dir/digiwords.db" ]; then - # restore - mkdir -p "$install_dir/www/inc" - mv "$install_dir/digiwords.db" "$install_dir/www/inc" - fi -fi - -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" @@ -82,7 +30,6 @@ chown -R "$app:www-data" "$install_dir" #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 -# Create a dedicated NGINX config ynh_add_nginx_config ynh_add_fpm_config diff --git a/tests.toml b/tests.toml index 3be94b0..94abb79 100644 --- a/tests.toml +++ b/tests.toml @@ -3,10 +3,3 @@ test_format = 1.0 [default] - - args.apikey_pixabay = "cafe1007" - args.apikey_google_youtube = "1337c0c4" - - test_upgrade_from.3bb42cd71bcca77b7f642859bf5048317586a500.name = "First release" - test_upgrade_from.3bb42cd71bcca77b7f642859bf5048317586a500.args.pixabay = "cafe1007" - test_upgrade_from.3bb42cd71bcca77b7f642859bf5048317586a500.args.googleYoutube = "1337c0c4"