1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jeedom_ynh.git synced 2024-09-03 19:26:26 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 00:57:10 +02:00 committed by Alexandre Aubin
parent 9bf6bf9b59
commit cb131e765c
12 changed files with 90 additions and 107 deletions

View file

@ -1 +1 @@
* * * * * root /usr/bin/php__PHPVERSION__ -f __INSTALL_DIR__/core/php/jeeCron.php
* * * * * root /usr/bin/php__PHP_VERSION__ -f __INSTALL_DIR__/core/php/jeeCron.php

View file

@ -1 +1 @@
* * * * * root /usr/bin/php__PHPVERSION__ -f __INSTALL_DIR__/core/php/watchdog.php
* * * * * root /usr/bin/php__PHP_VERSION__ -f __INSTALL_DIR__/core/php/watchdog.php

View file

@ -1,5 +1,3 @@
; Additional php.ini defines, specific to this pool of workers.
php_admin_value[upload_max_filesize] = 1G
php_admin_value[post_max_size] = 1G
php_admin_value[max_execution_time] = 300

View file

@ -12,7 +12,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
fastcgi_index index.php;
include fastcgi_params;

View file

@ -19,7 +19,8 @@ code = "https://github.com/jeedom/core"
cpe = "cpe:2.3:a:jeedom:jeedom"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = false
ldap = true
@ -59,6 +60,7 @@ ram.runtime = "200M"
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.permissions]
main.url = "/"

View file

@ -1,11 +1,7 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
#=================================================
# PERSONAL HELPERS
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
_jeedom_set_permission() {
@ -28,11 +24,3 @@ _jeedom_set_permission() {
fi
fi
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -8,40 +8,37 @@
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"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
# Backup the PHP-FPM configuration
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# Backup the nginx configuration
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
# Backup the cron configuration
ynh_backup --src_path="/etc/cron.d/${app}"
ynh_backup --src_path="/etc/cron.d/${app}_watchdog"
ynh_backup "/etc/cron.d/${app}"
ynh_backup "/etc/cron.d/${app}_watchdog"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_mysql_dump_db > db.sql
#=================================================
# 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)."

View file

@ -10,12 +10,12 @@ source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app"
ynh_script_progression "Change of URL completed for $app"

View file

@ -7,24 +7,25 @@
source _common.sh
source /usr/share/yunohost/helpers
ynh_app_setting_set --key=php_upload_max_filesize --value=1G
#=================================================
# CONFIGURING RIGHTS
#=================================================
ynh_script_progression --message="Configuring permissions..."
ynh_script_progression "Configuring permissions..."
_jeedom_set_permission
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
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"
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"
# FIXME: is it used?? It's not even reboot persistent…
# Create tmp required by Jeedom
mkdir -p /tmp/jeedom
@ -34,46 +35,45 @@ chown "$app:www-data" -R /tmp/jeedom
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
ynh_script_progression "Adding $app's configuration files..."
ynh_add_config --template="common.config.php" --destination="$install_dir/core/config/common.config.php"
ynh_config_add --template="common.config.php" --destination="$install_dir/core/config/common.config.php"
chmod 400 "$install_dir/core/config/common.config.php"
chown "$app:$app" "$install_dir/core/config/common.config.php"
#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/core/config/common.config.php"
#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/core/config/common.config.php"
#=================================================
# INSTALL JEEDOM
#=================================================
ynh_script_progression --message="Installing $app..."
ynh_script_progression "Installing $app..."
# Install Jeedom
"php$phpversion" "$install_dir/install/install.php" mode=force
"php$php_version" "$install_dir/install/install.php" mode=force
# Configure LDAP and the Admin User and access settings
ynh_add_config --template="config.sql" --destination="$install_dir/config.sql"
ynh_mysql_execute_file_as_root --file="$install_dir/config.sql" --database="$db_name"
ynh_secure_remove --file="$install_dir/config.sql"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
ynh_config_add --template="config.sql" --destination="$install_dir/config.sql"
ynh_mysql_db_shell " < "$install_dir/config.sql""
ynh_safe_rm "$install_dir/config.sql"
#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"
#=================================================
# 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 PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Cron
ynh_add_config --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_add_config --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
ynh_config_add --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_config_add --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed"
ynh_script_progression "Installation of $app completed"

View file

@ -10,27 +10,27 @@ source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
ynh_script_progression "Removing system configurations related to $app..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
ynh_config_remove_phpfpm
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_script_progression "Removing various files..."
# Remove cron files
ynh_secure_remove --file="/etc/cron.d/${app}"
ynh_secure_remove --file="/etc/cron.d/${app}_watchdog"
ynh_safe_rm "/etc/cron.d/${app}"
ynh_safe_rm "/etc/cron.d/${app}_watchdog"
ynh_secure_remove --file="/tmp/jeedom"
ynh_safe_rm "/tmp/jeedom"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"
ynh_script_progression "Removal of $app completed"

View file

@ -11,20 +11,19 @@ source /usr/share/yunohost/helpers
#=================================================
# CONFIGURING RIGHTS
#=================================================
ynh_script_progression --message="Configuring permissions..."
ynh_script_progression "Configuring permissions..."
_jeedom_set_permission
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$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 | 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"
# Create tmp required by Jeedom
mkdir -p /tmp/jeedom
chmod 750 /tmp/jeedom
@ -33,36 +32,36 @@ chown "$app:www-data" -R /tmp/jeedom
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_script_progression "Restoring the MySQL database..."
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
ynh_mysql_db_shell < ./db.sql
#=================================================
# 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/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
ynh_config_add_phpfpm
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/cron.d/${app}"
ynh_restore_file --origin_path="/etc/cron.d/${app}_watchdog"
ynh_restore "/etc/cron.d/${app}"
ynh_restore "/etc/cron.d/${app}_watchdog"
#=================================================
# 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="php$phpversion-fpm" --action=reload
ynh_systemctl --service="php$php_version-fpm" --action=reload
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"
ynh_script_progression "Restoration completed for $app"

View file

@ -7,29 +7,30 @@
source _common.sh
source /usr/share/yunohost/helpers
ynh_app_setting_set_default --key=php_upload_max_filesize --value=1G
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..."
#ynh_script_progression "Ensuring downward compatibility..."
#=================================================
# CONFIGURING RIGHTS
#=================================================
ynh_script_progression --message="Configuring permissions..."
ynh_script_progression "Configuring permissions..."
_jeedom_set_permission
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..."
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="/core/config/common.config.php"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="/core/config/common.config.php"
#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"
# Create tmp required by Jeedom
mkdir -p /tmp/jeedom
chmod 750 /tmp/jeedom
@ -38,43 +39,41 @@ chown "$app:www-data" -R /tmp/jeedom
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating $app's configuration files..."
ynh_script_progression "Updating $app's configuration files..."
ynh_add_config --template="common.config.php" --destination="$install_dir/core/config/common.config.php"
chmod 400 "$install_dir/core/config/common.config.php"
chown "$app:$app" "$install_dir/core/config/common.config.php"
ynh_config_add --template="common.config.php" --destination="$install_dir/core/config/common.config.php"
#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/core/config/common.config.php"
#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/core/config/common.config.php"
#=================================================
# UPGRADE JEEDOM
#=================================================
ynh_script_progression --message="Upgrading Jeedom..."
ynh_script_progression "Upgrading Jeedom..."
# Upgrade Jeedom
"php$phpversion" "$install_dir/install/install.php" mode=force
"php$php_version" "$install_dir/install/install.php" mode=force
# Check
# "php$phpversion" "$install_dir/install/sick.php"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
# "php$php_version" "$install_dir/install/sick.php"
#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"
#=================================================
# 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 PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Cron
ynh_add_config --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_add_config --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
ynh_config_add --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_config_add --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"
ynh_script_progression "Upgrade of $app completed"