From 7ee2f5a677e6bffb3baca6931cf2d2451fc5f0e0 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sat, 31 Aug 2024 01:13:31 +0200 Subject: [PATCH 1/9] [autopatch] Automatic patch attempt for helpers 2.1 --- manifest.toml | 2 +- scripts/change_url | 4 +- scripts/config | 95 ---------------------------------------------- scripts/install | 16 ++++---- scripts/restore | 4 +- scripts/upgrade | 8 ++-- 6 files changed, 17 insertions(+), 112 deletions(-) delete mode 100644 scripts/config diff --git a/manifest.toml b/manifest.toml index c8934a8..e84de1f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ code = "https://github.com/owncloud/ocis" cpe = "cpe:2.3:a:owncloud:owncloud" [integration] -yunohost = ">= 11.2.20" +yunohost = ">= 11.2.18" helpers_version = "2.1" architectures = ["amd64", "arm64", "armhf", "i386"] multi_instance = false diff --git a/scripts/change_url b/scripts/change_url index ad09d98..131d0f3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -26,8 +26,8 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$install_dir/ocis.env" -chmod 400 "$install_dir/ocis.env" -chown $app:$app "$install_dir/ocis.env" +#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/ocis.env" +#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/ocis.env" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/config b/scripts/config deleted file mode 100644 index 14f410d..0000000 --- a/scripts/config +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# In simple cases, you don't need a config script. - -# With a simple config_panel.toml, you can write in the app settings, in the - -# upstream config file or replace complete files (logo ...) and restart services. - -# The config scripts allows you to go further, to handle specific cases - -# (validation of several interdependent fields, specific getter/setter for a value, -# display dynamic informations or choices, pre-loading of config type .cube... ). - -source /usr/share/yunohost/helpers - -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -final_path=$(ynh_app_setting_get $app final_path) - -#================================================= -# SPECIFIC GETTERS FOR TOML SHORT KEY -#================================================= - -get__amount() { - # Here we can imagine to have an API call to stripe to know the amount of donation during a month - local amount = 200 - - # It's possible to change some properties of the question by overriding it: - if [ $amount -gt 100 ] - then - cat << EOF -style: success -value: $amount -ask: - en: A lot of donation this month: **$amount €** -EOF - else - cat << EOF -style: danger -value: $amount -ask: - en: Not so much donation this month: $amount € -EOF - fi -} - -get__prices() { - local prices = "$(grep "DONATION\['" "$final_path/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')" - if [ "$prices" == "," ]; - then - # Return YNH_NULL if you prefer to not return a value at all. - echo YNH_NULL - else - echo $prices - fi -} - -#================================================= -# SPECIFIC VALIDATORS FOR TOML SHORT KEYS -#================================================= -validate__publishable_key() { - - # We can imagine here we test if the key is really a publisheable key - (is_secret_key $publishable_key) && - echo 'This key seems to be a secret key' -} - -#================================================= -# SPECIFIC SETTERS FOR TOML SHORT KEYS -#================================================= -set__prices() { - - #--------------------------------------------- - # IMPORTANT: setter are trigger only if a change is detected - #--------------------------------------------- - for price in $(echo $prices | sed "s/,/ /"); do - frequency=$(echo $price | cut -d/ -f1) - currency=$(echo $price | cut -d/ -f2) - price_id=$(echo $price | cut -d/ -f3) - sed "d/DONATION\['$frequency'\]\['$currency'\]" "$final_path/settings.py" - - echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py" - done - - #--------------------------------------------- - # IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too - #--------------------------------------------- - ynh_app_setting_set $app prices $prices -} - -#================================================= -ynh_app_config_run $1 diff --git a/scripts/install b/scripts/install index a6cc2da..f0fe8cf 100755 --- a/scripts/install +++ b/scripts/install @@ -10,8 +10,8 @@ ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir="$install_dir" -chmod -R o-rwx "$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 | chmod -R o-rwx "$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" chmod +x $install_dir/ocis #================================================= @@ -32,8 +32,8 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$data_dir/config/ocis.env" -chmod 400 "$data_dir/config/ocis.env" -chown $app:$app "$data_dir/config/ocis.env" +#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 "$data_dir/config/ocis.env" +#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 "$data_dir/config/ocis.env" #================================================= # INSTALL OWNCLOUD @@ -44,10 +44,10 @@ pushd "$install_dir" ./ocis init --insecure=true --force-overwrite=true --admin-password=$password --config-path=$data_dir/config/ popd -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" -chown $app:$app "$data_dir/config/ocis.yaml" +#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 | chmod 750 "$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 | chmod -R o-rwx "$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" +#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 "$data_dir/config/ocis.yaml" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index db3de1f..0104efe 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,8 +10,8 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -chmod -R o-rwx "$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 | chmod -R o-rwx "$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" chmod +x $install_dir/ocis #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1ea9582..12e33d0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,8 +26,8 @@ ynh_script_progression "Upgrading source files..." ynh_setup_source --dest_dir="$install_dir" --full_replace -chmod -R o-rwx "$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 | chmod -R o-rwx "$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" chmod +x $install_dir/ocis #================================================= @@ -48,8 +48,8 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$install_dir/ocis.env" -chmod 400 "$install_dir/ocis.env" -chown $app:$app "$install_dir/ocis.env" +#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/ocis.env" +#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/ocis.env" #================================================= # START SYSTEMD SERVICE From cf10e9c37a5c2e916f5e551821c07d7a11cae67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:06:38 +0200 Subject: [PATCH 2/9] cleaning --- manifest.toml | 2 +- scripts/change_url | 3 --- scripts/install | 10 ---------- scripts/remove | 2 -- scripts/restore | 2 -- scripts/upgrade | 5 ----- 6 files changed, 1 insertion(+), 23 deletions(-) diff --git a/manifest.toml b/manifest.toml index e84de1f..b0837b7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ code = "https://github.com/owncloud/ocis" cpe = "cpe:2.3:a:owncloud:owncloud" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = ["amd64", "arm64", "armhf", "i386"] multi_instance = false diff --git a/scripts/change_url b/scripts/change_url index 131d0f3..274698d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -26,9 +26,6 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$install_dir/ocis.env" -#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/ocis.env" -#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/ocis.env" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/install b/scripts/install index f0fe8cf..c8f5baa 100755 --- a/scripts/install +++ b/scripts/install @@ -10,8 +10,6 @@ ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir="$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 | chmod -R o-rwx "$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" chmod +x $install_dir/ocis #================================================= @@ -32,9 +30,6 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$data_dir/config/ocis.env" -#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 "$data_dir/config/ocis.env" -#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 "$data_dir/config/ocis.env" - #================================================= # INSTALL OWNCLOUD #================================================= @@ -44,11 +39,6 @@ pushd "$install_dir" ./ocis init --insecure=true --force-overwrite=true --admin-password=$password --config-path=$data_dir/config/ popd -#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 | chmod 750 "$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 | chmod -R o-rwx "$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" -#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 "$data_dir/config/ocis.yaml" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index ed34c62..98764ca 100755 --- a/scripts/remove +++ b/scripts/remove @@ -6,8 +6,6 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE -#================================================= ynh_script_progression "Removing system configurations related to $app..." if ynh_hide_warnings yunohost service status $app >/dev/null diff --git a/scripts/restore b/scripts/restore index 0104efe..6c621a4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..." 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 | chmod -R o-rwx "$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" chmod +x $install_dir/ocis #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 12e33d0..6b95c09 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,8 +26,6 @@ ynh_script_progression "Upgrading source files..." ynh_setup_source --dest_dir="$install_dir" --full_replace -#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 | chmod -R o-rwx "$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" chmod +x $install_dir/ocis #================================================= @@ -48,9 +46,6 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$install_dir/ocis.env" -#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/ocis.env" -#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/ocis.env" - #================================================= # START SYSTEMD SERVICE #================================================= From ceddb31814646979265eec074ae88c3a09f12b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:16:38 +0200 Subject: [PATCH 3/9] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index c8f5baa..f47388b 100755 --- a/scripts/install +++ b/scripts/install @@ -39,6 +39,8 @@ pushd "$install_dir" ./ocis init --insecure=true --force-overwrite=true --admin-password=$password --config-path=$data_dir/config/ popd +hown $app:$app "$data_dir/config/ocis.yaml" + #================================================= # START SYSTEMD SERVICE #================================================= From 3f4d7675283adb74c25f06ebd2f743fcdf79fc7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:20:46 +0200 Subject: [PATCH 4/9] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index f47388b..ba07e11 100755 --- a/scripts/install +++ b/scripts/install @@ -39,7 +39,7 @@ pushd "$install_dir" ./ocis init --insecure=true --force-overwrite=true --admin-password=$password --config-path=$data_dir/config/ popd -hown $app:$app "$data_dir/config/ocis.yaml" +chown $app:$app "$data_dir/config/ocis.yaml" #================================================= # START SYSTEMD SERVICE From 879b6b35ba576450a097aa4af0df53d856d6626a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:33:56 +0200 Subject: [PATCH 5/9] fix --- scripts/install | 4 ++++ scripts/upgrade | 3 +++ 2 files changed, 7 insertions(+) diff --git a/scripts/install b/scripts/install index ba07e11..c91b147 100755 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,9 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$data_dir/config/ocis.env" +chmod 400 "$data_dir/config/ocis.env" +chown $app:$app "$data_dir/config/ocis.env" + #================================================= # INSTALL OWNCLOUD #================================================= @@ -39,6 +42,7 @@ pushd "$install_dir" ./ocis init --insecure=true --force-overwrite=true --admin-password=$password --config-path=$data_dir/config/ popd +chmod 400 "$data_dir/config/ocis.yaml" chown $app:$app "$data_dir/config/ocis.yaml" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6b95c09..456ba44 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,6 +46,9 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$install_dir/ocis.env" +chmod 400 "$data_dir/config/ocis.env" +chown $app:$app "$data_dir/config/ocis.env" + #================================================= # START SYSTEMD SERVICE #================================================= From dbc2612759515aa965a6593f0d5e07f240956fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:41:29 +0200 Subject: [PATCH 6/9] Update restore --- scripts/restore | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/restore b/scripts/restore index 6c621a4..7ba4a1a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -20,6 +20,7 @@ ynh_script_progression "Restoring the data directory..." ynh_restore "$data_dir" chown -R $app:www-data "$data_dir" +chown $app:$app "$data_dir/config/ocis.yaml" #================================================= # RESTORE SYSTEM CONFIGURATIONS From c7c398ac2c22bdf671aac6fc214739906218429b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:58:18 +0200 Subject: [PATCH 7/9] cleaning --- scripts/install | 3 --- scripts/restore | 1 - scripts/upgrade | 3 --- 3 files changed, 7 deletions(-) diff --git a/scripts/install b/scripts/install index c91b147..8ae3d78 100755 --- a/scripts/install +++ b/scripts/install @@ -30,9 +30,6 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$data_dir/config/ocis.env" -chmod 400 "$data_dir/config/ocis.env" -chown $app:$app "$data_dir/config/ocis.env" - #================================================= # INSTALL OWNCLOUD #================================================= diff --git a/scripts/restore b/scripts/restore index 7ba4a1a..6c621a4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -20,7 +20,6 @@ ynh_script_progression "Restoring the data directory..." ynh_restore "$data_dir" chown -R $app:www-data "$data_dir" -chown $app:$app "$data_dir/config/ocis.yaml" #================================================= # RESTORE SYSTEM CONFIGURATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 456ba44..6b95c09 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,9 +46,6 @@ ynh_script_progression "Adding $app's configuration..." ynh_config_add --template=".env" --destination="$install_dir/ocis.env" -chmod 400 "$data_dir/config/ocis.env" -chown $app:$app "$data_dir/config/ocis.env" - #================================================= # START SYSTEMD SERVICE #================================================= From 428ad3eb1d2e145b3dabfc1079805e5f5e25fd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:36:21 +0200 Subject: [PATCH 8/9] Update restore --- scripts/restore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/restore b/scripts/restore index 6c621a4..3341b10 100755 --- a/scripts/restore +++ b/scripts/restore @@ -20,6 +20,8 @@ ynh_script_progression "Restoring the data directory..." ynh_restore "$data_dir" chown -R $app:www-data "$data_dir" +chmod 400 "$data_dir/config/ocis.yaml" +chown $app:$app "$data_dir/config/ocis.yaml" #================================================= # RESTORE SYSTEM CONFIGURATIONS From 08270a3aec220c47059c40ae0a46f03963e1fd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:07:11 +0200 Subject: [PATCH 9/9] Update restore --- scripts/restore | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/restore b/scripts/restore index 3341b10..fc28ef3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,6 +10,7 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" +chown -R "$app:www-data" "$install_dir" chmod +x $install_dir/ocis #=================================================