mirror of
https://github.com/YunoHost-Apps/zwave-js-ui_ynh.git
synced 2024-09-03 18:06:00 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
930ad5cfd2
commit
0a64da4117
11 changed files with 92 additions and 163 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -18,7 +18,8 @@ code = "https://github.com/zwave-js/zwave-js-ui"
|
||||||
fund = "https://liberapay.com/robertsLando/donate"
|
fund = "https://liberapay.com/robertsLando/donate"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.1.18"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = [ "amd64", "armhf", "arm64" ]
|
architectures = [ "amd64", "armhf", "arm64" ]
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
ldap = "not_relevant"
|
ldap = "not_relevant"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
if [[ "$YNH_ARCH" == "armhf" ]] || [[ "$YNH_ARCH" == "arm64" ]]
|
if [[ "$YNH_ARCH" == "armhf" ]] || [[ "$YNH_ARCH" == "arm64" ]]
|
||||||
then
|
then
|
||||||
|
@ -9,14 +9,6 @@ then
|
||||||
else
|
else
|
||||||
file_exec="zwave-js-ui-linux"
|
file_exec="zwave-js-ui-linux"
|
||||||
fi
|
fi
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
|
@ -1,31 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
@ -33,17 +24,16 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# BACKUP LOGROTATE
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# 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)."
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -24,33 +18,33 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression "Loading installation settings..."
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_config_add_nginx"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --key=final_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --key=port)
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
# Add settings here as needed by your application
|
||||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
#db_name=$(ynh_app_setting_get --key=db_name)
|
||||||
#db_user=$db_name
|
#db_user=$db_name
|
||||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
#db_pwd=$(ynh_app_setting_get --key=db_pwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
ynh_script_progression "Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
#REMOVEME? ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
# 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"
|
ynh_safe_rm "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
# Restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
#REMOVEME? ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
@ -68,19 +62,17 @@ then
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -88,22 +80,22 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original NGINX config file if modified
|
# Make a backup of the original NGINX config file if modified
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
||||||
# Set global variables for NGINX helper
|
# Set global variables for NGINX helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for NGINX
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
ynh_delete_file_checksum "$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -112,24 +104,22 @@ fi
|
||||||
# ...
|
# ...
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service=$app --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
ynh_script_progression "Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
ynh_script_progression "Change of URL completed for $app"
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
ynh_script_progression "Configuring system user..."
|
||||||
|
|
||||||
usermod -d $install_dir $app
|
usermod -d $install_dir $app
|
||||||
|
|
||||||
|
@ -29,58 +23,55 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=8
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source
|
# Download, check integrity, uncompress and patch the source
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
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 750 "$install_dir"
|
||||||
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 | chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app: "$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: "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
ynh_script_progression "Configuring NGINX web server..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
ynh_script_progression "Configuring $app's systemd service..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
ynh_script_progression "Configuring log rotation..."
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate --logfile="/var/log/$app/$app.log"
|
ynh_config_add_logrotate "/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression "Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --line_match="Listening on port" -t 30 --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service=$app --action="start" --wait_until="Listening on port" -t 30
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -16,18 +10,18 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_hide_warnings yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
ynh_script_progression "Removing $app service integration..."
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_script_progression --message="Removing various system files..." --weight=1
|
ynh_script_progression "Removing various system files..."
|
||||||
|
|
||||||
ynh_remove_systemd_config
|
ynh_config_remove_systemd
|
||||||
|
|
||||||
ynh_remove_logrotate
|
ynh_config_remove_logrotate
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
ynh_script_progression "Recreating the dedicated system user..."
|
||||||
|
|
||||||
if grep dialout -q < /etc/group; then
|
if grep dialout -q < /etc/group; then
|
||||||
usermod -a -G dialout "$app"
|
usermod -a -G dialout "$app"
|
||||||
|
@ -26,50 +19,46 @@ if grep gpio -q < /etc/group; then
|
||||||
usermod -a -G gpio "$app"
|
usermod -a -G gpio "$app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
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 750 "$install_dir"
|
||||||
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 | chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app: "$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: "$install_dir"
|
||||||
|
ynh_script_progression "Restoring system configurations related to $app..."
|
||||||
|
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
mkdir -p /var/log/$app
|
mkdir -p /var/log/$app
|
||||||
chown -R $app:$app /var/log/$app
|
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app /var/log/$app
|
||||||
|
|
||||||
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --line_match="Listening on port" -t 30 --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service=$app --action="start" --wait_until="Listening on port" -t 30
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
ynh_script_progression "Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -1,33 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
ynh_script_progression "Making sure dedicated system user exists..."
|
||||||
|
|
||||||
if grep dialout -q < /etc/group; then
|
if grep dialout -q < /etc/group; then
|
||||||
usermod -a -G dialout "$app"
|
usermod -a -G dialout "$app"
|
||||||
|
@ -43,60 +29,59 @@ fi
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||||
|
if ynh_app_upstream_version_changed
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
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 750 "$install_dir"
|
||||||
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 | chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app: "$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: "$install_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
ynh_script_progression "Upgrading NGINX web server configuration..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
ynh_script_progression "Upgrading systemd configuration..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
ynh_script_progression "Upgrading logrotate configuration..."
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --logfile="/var/log/$app/$app.log" --non-append
|
ynh_config_add_logrotate "/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression "Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --line_match="Listening on port" -t 30 --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service=$app --action="start" --wait_until="Listening on port" -t 30
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
Loading…
Reference in a new issue