Skip to content

Commit 0efd202

Browse files
Yunohost-BotalexAubin
authored andcommitted
[autopatch] Automatic patch attempt for helpers 2.1
1 parent 0511fdc commit 0efd202

File tree

11 files changed

+101
-172
lines changed

11 files changed

+101
-172
lines changed

conf/cron

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@daily __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/scripts/cron.php
2-
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/scripts/emails.php
1+
@daily __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/scripts/cron.php
2+
* * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/scripts/emails.php
33

conf/extra_php-fpm.conf

Lines changed: 0 additions & 4 deletions
This file was deleted.

conf/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ location __PATH__/ {
1515
rewrite ^__PATH__/?(.*)$ __PATH__/_route.php?/$1 last;
1616
break;
1717
}
18-
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
18+
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
1919

2020
fastcgi_index index.php;
2121
include fastcgi_params;

manifest.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ admindoc = "https://fossil.kd2.org/paheko/wiki?name=Documentation"
1717
code = "https://fossil.kd2.org/paheko/dir?ci=tip"
1818

1919
[integration]
20-
yunohost = ">= 11.2"
20+
yunohost = ">= 11.2.18"
21+
helpers_version = "2.1"
2122
architectures = "all"
2223
multi_instance = true
2324
ldap = false
@@ -44,6 +45,7 @@ ram.runtime = "50M"
4445
allow_email = true
4546

4647
[resources.install_dir]
48+
group = "www-data:r-x"
4749

4850
[resources.data_dir]
4951

scripts/_common.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
#!/bin/bash
22

33
#=================================================
4-
# COMMON VARIABLES
4+
# COMMON VARIABLES AND CUSTOM HELPERS
55
#=================================================
66
# PHP APP SPECIFIC
77
#=================================================
8-
9-
#=================================================
10-
# PERSONAL HELPERS
11-
#=================================================
12-
13-
#=================================================
14-
# EXPERIMENTAL HELPERS
15-
#=================================================
16-
17-
#=================================================
18-
# FUTURE OFFICIAL HELPERS
19-
#=================================================

scripts/backup

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,43 @@
11
#!/bin/bash
22

3-
#=================================================
4-
# GENERIC START
5-
#=================================================
6-
# IMPORT GENERIC HELPERS
7-
#=================================================
8-
93
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
104
source ../settings/scripts/_common.sh
115
source /usr/share/yunohost/helpers
126

13-
#=================================================
14-
# DECLARE DATA AND CONF FILES TO BACKUP
15-
#=================================================
16-
ynh_print_info --message="Declaring files to be backed up..."
7+
ynh_print_info "Declaring files to be backed up..."
178

189
#=================================================
1910
# BACKUP THE APP MAIN DIR
2011
#=================================================
2112

22-
ynh_backup --src_path="$install_dir"
13+
ynh_backup "$install_dir"
2314

2415
#=================================================
2516
# BACKUP THE DATA DIR
2617
#=================================================
2718

28-
ynh_backup --src_path="$data_dir" --is_big
19+
ynh_backup "$data_dir"
2920

3021
#=================================================
3122
# BACKUP THE NGINX CONFIGURATION
3223
#=================================================
3324

34-
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
25+
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
3526

3627
#=================================================
3728
# BACKUP THE PHP-FPM CONFIGURATION
3829
#=================================================
3930

40-
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
31+
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
4132

4233
#=================================================
4334
# BACKUP VARIOUS FILES
4435
#=================================================
4536

46-
ynh_backup --src_path="/etc/cron.d/$app"
37+
ynh_backup "/etc/cron.d/$app"
4738

4839
#=================================================
4940
# END OF SCRIPT
5041
#=================================================
5142

52-
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
43+
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

scripts/change_url

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
#!/bin/bash
22

3-
#=================================================
4-
# GENERIC STARTING
5-
#=================================================
6-
# IMPORT GENERIC HELPERS
7-
#=================================================
8-
93
source _common.sh
104
source /usr/share/yunohost/helpers
115

12-
#=================================================
13-
# STANDARD MODIFICATIONS
146
#=================================================
157
# MODIFY URL IN NGINX CONF
168
#=================================================
17-
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=5
9+
ynh_script_progression "Updating NGINX web server configuration..."
1810

19-
ynh_change_url_nginx_config
11+
ynh_config_change_url_nginx
2012

2113
#=================================================
2214
# SPECIFIC MODIFICATIONS
2315
#=================================================
2416
# UPDATE A CONFIG FILE
2517
#=================================================
26-
ynh_script_progression --message="Updating a configuration file..." --weight=1
18+
ynh_script_progression "Updating configuration..."
2719

2820
domain=$new_domain
2921
path=$new_path
30-
ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php"
22+
ynh_config_add --template="config.local.php" --destination="$install_dir/config.local.php"
3123

3224
#=================================================
3325
# END OF SCRIPT
3426
#=================================================
3527

36-
ynh_script_progression --message="Change of URL completed for $app" --last
28+
ynh_script_progression "Change of URL completed for $app"

scripts/install

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,51 @@
11
#!/bin/bash
22

3-
#=================================================
4-
# GENERIC START
5-
#=================================================
6-
# IMPORT GENERIC HELPERS
7-
#=================================================
8-
93
source _common.sh
104
source /usr/share/yunohost/helpers
115

126
secret_key=$(ynh_string_random --length=50)
13-
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
7+
ynh_app_setting_set --key=secret_key --value=$secret_key
148

159
#=================================================
1610
# DOWNLOAD, CHECK AND UNPACK SOURCE
1711
#=================================================
18-
ynh_script_progression --message="Setting up source files..." --weight=4
12+
ynh_script_progression "Setting up source files..."
1913

2014
# Download, check integrity, uncompress and patch the source from app.src
2115
ynh_setup_source --dest_dir="$install_dir"
2216

23-
chmod -R o-rwx "$install_dir"
24-
chown -R $app:www-data "$install_dir"
25-
17+
#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"
18+
#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"
2619
#=================================================
2720
# SYSTEM CONFIGURATION
2821
#=================================================
29-
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
22+
ynh_script_progression "Adding system configurations related to $app..."
3023

3124
# Create a dedicated PHP-FPM config
32-
ynh_add_fpm_config
25+
ynh_config_add_phpfpm
3326

3427
# Create a dedicated NGINX config
35-
ynh_add_nginx_config
28+
ynh_config_add_nginx
3629

37-
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
38-
chown root: "/etc/cron.d/$app"
39-
chmod 644 "/etc/cron.d/$app"
30+
ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
31+
#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 root: "/etc/cron.d/$app"
32+
#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 644 "/etc/cron.d/$app"
4033

4134
#=================================================
4235
# SPECIFIC SETUP
4336
#=================================================
4437
# ADD A CONFIGURATION
4538
#=================================================
46-
ynh_script_progression --message="Adding a configuration files..." --weight=5
39+
ynh_script_progression "Adding $app's configuration...."
4740

4841
# Install configuration files
49-
ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php"
42+
ynh_config_add --template="config.local.php" --destination="$install_dir/config.local.php"
5043

51-
chmod 440 "$install_dir/config.local.php"
52-
chown $app:$app "$install_dir/config.local.php"
44+
#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 440 "$install_dir/config.local.php"
45+
#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/config.local.php"
5346

5447
#=================================================
5548
# END OF SCRIPT
5649
#=================================================
5750

58-
ynh_script_progression --message="Installation of $app completed" --last
51+
ynh_script_progression "Installation of $app completed"

scripts/remove

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
#!/bin/bash
22

3-
#=================================================
4-
# GENERIC START
5-
#=================================================
6-
# IMPORT GENERIC HELPERS
7-
#=================================================
8-
93
source _common.sh
104
source /usr/share/yunohost/helpers
115

126
#=================================================
137
# REMOVE SYSTEM CONFIGURATIONS
148
#=================================================
15-
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
9+
ynh_script_progression "Removing system configurations related to $app..."
1610

1711
# Remove the dedicated NGINX config
18-
ynh_remove_nginx_config
12+
ynh_config_remove_nginx
1913

2014
# Remove the dedicated PHP-FPM config
21-
ynh_remove_fpm_config
15+
ynh_config_remove_phpfpm
2216

2317
# Remove a cron file
24-
ynh_secure_remove --file="/etc/cron.d/$app"
18+
ynh_safe_rm "/etc/cron.d/$app"
2519

2620
#=================================================
2721
# END OF SCRIPT
2822
#=================================================
2923

30-
ynh_script_progression --message="Removal of $app completed" --last
24+
ynh_script_progression "Removal of $app completed"

scripts/restore

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,50 @@
11
#!/bin/bash
22

3-
#=================================================
4-
# GENERIC START
5-
#=================================================
6-
# IMPORT GENERIC HELPERS
7-
#=================================================
8-
93
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
104
source ../settings/scripts/_common.sh
115
source /usr/share/yunohost/helpers
126

137
#=================================================
148
# RESTORE THE APP MAIN DIR
159
#=================================================
16-
ynh_script_progression --message="Restoring the app main directory..." --weight=5
17-
18-
ynh_restore_file --origin_path="$install_dir"
10+
ynh_script_progression "Restoring the app main directory..."
1911

20-
chmod -R o-rwx "$install_dir"
21-
chown -R $app:www-data "$install_dir"
12+
ynh_restore "$install_dir"
2213

14+
#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"
15+
#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"
2316
#=================================================
2417
# RESTORE THE DATA DIRECTORY
2518
#=================================================
26-
ynh_script_progression --message="Restoring the data directory..." --weight=1
19+
ynh_script_progression "Restoring the data directory..."
2720

28-
ynh_restore_file --origin_path="$data_dir" --not_mandatory
21+
ynh_restore "$data_dir"
2922

3023
#=================================================
3124
# RESTORE SYSTEM CONFIGURATIONS
3225
#=================================================
3326
# RESTORE THE PHP-FPM CONFIGURATION
3427
#=================================================
35-
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
28+
ynh_script_progression "Restoring system configurations related to $app..."
3629

37-
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
30+
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
3831

39-
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
32+
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
4033

41-
ynh_restore_file --origin_path="/etc/cron.d/$app"
42-
chown root: "/etc/cron.d/$app"
43-
chmod 644 "/etc/cron.d/$app"
34+
ynh_restore "/etc/cron.d/$app"
35+
#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 root: "/etc/cron.d/$app"
36+
#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 644 "/etc/cron.d/$app"
4437

45-
#=================================================
46-
# GENERIC FINALIZATION
4738
#=================================================
4839
# RELOAD NGINX AND PHP-FPM
4940
#=================================================
50-
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
41+
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
5142

52-
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
53-
ynh_systemd_action --service_name=nginx --action=reload
43+
ynh_systemctl --service=php$php_version-fpm --action=reload
44+
ynh_systemctl --service=nginx --action=reload
5445

5546
#=================================================
5647
# END OF SCRIPT
5748
#=================================================
5849

59-
ynh_script_progression --message="Restoration completed for $app" --last
50+
ynh_script_progression "Restoration completed for $app"

0 commit comments

Comments
 (0)