mirror of
https://github.com/YunoHost-Apps/scrutiny_ynh.git
synced 2024-09-03 20:16:24 +02:00
Merge pull request #27 from yunohost-bot/auto-helpers-2.1
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
commit
081e6510bc
9 changed files with 104 additions and 164 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*~
|
||||
*.sw[op]
|
||||
.DS_Store
|
||||
|
|
|
@ -15,7 +15,8 @@ code = "https://github.com/AnalogJ/scrutiny"
|
|||
fund = "https://paypal.me/analogj/usd10"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = ["amd64", "arm64"]
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
|
|
|
@ -1,25 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
ynh_arch="$YNH_ARCH"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
myynh_set_permissions () {
|
||||
chown -R $app: "$install_dir"
|
||||
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 | 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 | 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"
|
||||
chmod -R +x "$install_dir/bin/"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,30 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
@ -32,19 +23,19 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
ynh_backup --src_path="/var/log/$app"
|
||||
ynh_backup "/etc/logrotate.d/$app"
|
||||
ynh_backup "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/scrutiny-web-server.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/scrutiny-collector.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/scrutiny-collector.timer"
|
||||
ynh_backup "/etc/systemd/system/scrutiny-web-server.service"
|
||||
ynh_backup "/etc/systemd/system/scrutiny-collector.service"
|
||||
ynh_backup "/etc/systemd/system/scrutiny-collector.timer"
|
||||
|
||||
#=================================================
|
||||
# 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,34 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# 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="influxdb" --action="stop"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="stop" --log_path="/var/log/$app/web-server.log"
|
||||
ynh_systemctl --service="influxdb" --action="stop"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="stop" --log_path="/var/log/$app/web-server.log"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="stop" --log_path="/var/log/$app/collector.log"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="stop" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
|
@ -48,34 +40,32 @@ then
|
|||
key="basepath"
|
||||
new_value="'$new_base_path'"
|
||||
sed --regexp-extended "s/^(\s*${key}:\s*).*/\1${new_value}/" --in-place "$install_dir/config/scrutiny.yaml"
|
||||
ynh_store_file_checksum --file="$install_dir/config/scrutiny.yaml"
|
||||
ynh_store_file_checksum "$install_dir/config/scrutiny.yaml"
|
||||
|
||||
# Update collector.yaml
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
port=$(ynh_app_setting_get --key=port)
|
||||
key="endpoint"
|
||||
new_value="'http:\/\/127.0.0.1:${port}${new_base_path}\/'"
|
||||
sed --regexp-extended "s/^(\s*${key}:\s*).*/\1${new_value}/" --in-place "$install_dir/config/collector.yaml"
|
||||
ynh_store_file_checksum --file="$install_dir/config/collector.yaml"
|
||||
ynh_store_file_checksum "$install_dir/config/collector.yaml"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
ynh_systemctl --service="influxdb" --action="start"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,7 +8,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
mkdir -p "$install_dir/bin"
|
||||
ynh_setup_source --source_id="main" --dest_dir="$install_dir/bin"
|
||||
|
@ -26,30 +20,30 @@ ynh_setup_source --source_id="scrutiny-web-frontend" --dest_dir="$install_dir/we
|
|||
#=================================================
|
||||
# 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 NGINX config using the conf/nginx.conf template
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
|
||||
ynh_config_add_systemd --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
|
||||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log" --test_status="systemctl show scrutiny-web-server.service -p ActiveState --value | grep -v failed"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
ynh_config_add --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
|
||||
fi
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate --specific_user="$app"
|
||||
ynh_config_add_logrotate
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
mkdir -p "$install_dir/config"
|
||||
if [ "${path}" == "/" ]
|
||||
|
@ -58,10 +52,10 @@ then
|
|||
else
|
||||
base_path="${path}"
|
||||
fi
|
||||
ynh_add_config --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
|
||||
ynh_config_add --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
|
||||
ynh_add_config --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
|
||||
ynh_config_add --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
|
||||
ynh_config_add --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
|
||||
|
||||
#=================================================
|
||||
# SET FILE OWNERSHIP / PERMISSIONS
|
||||
|
@ -69,26 +63,24 @@ ynh_add_config --template="config/collector.yaml" --destination="$install_dir/co
|
|||
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_systemd_action --service_name="influxdb" --action="enable"
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
ynh_systemctl --service="influxdb" --action="enable"
|
||||
ynh_systemctl --service="influxdb" --action="start"
|
||||
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="enable"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
systemctl daemon-reload
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="enable"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -13,32 +7,33 @@ source /usr/share/yunohost/helpers
|
|||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Removing system configurations related to $app..."
|
||||
|
||||
if ynh_exec_warn_less yunohost service status "scrutiny-web-server" >/dev/null
|
||||
if ynh_hide_warnings yunohost service status "scrutiny-web-server" >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing scrutiny-web-server service integration..." --weight=1
|
||||
ynh_script_progression "Removing scrutiny-web-server service integration..."
|
||||
yunohost service remove "scrutiny-web-server"
|
||||
fi
|
||||
|
||||
if ynh_exec_warn_less yunohost service status "scrutiny-collector" >/dev/null
|
||||
if ynh_hide_warnings yunohost service status "scrutiny-collector" >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing scrutiny-collector service integration..." --weight=1
|
||||
ynh_script_progression "Removing scrutiny-collector service integration..."
|
||||
yunohost service remove "scrutiny-collector"
|
||||
fi
|
||||
|
||||
ynh_remove_systemd_config --service="scrutiny-web-server"
|
||||
ynh_remove_systemd_config --service="scrutiny-collector"
|
||||
ynh_secure_remove --file="/etc/systemd/system/scrutiny-collector.timer"
|
||||
ynh_config_remove_systemd"scrutiny-web-server"
|
||||
ynh_config_remove_systemd"scrutiny-collector"
|
||||
ynh_safe_rm "/etc/systemd/system/scrutiny-collector.timer"
|
||||
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
ynh_remove_logrotate
|
||||
ynh_config_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,63 +1,55 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
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/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-web-server.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.timer"
|
||||
ynh_restore "/etc/systemd/system/scrutiny-web-server.service"
|
||||
ynh_restore "/etc/systemd/system/scrutiny-collector.service"
|
||||
ynh_restore "/etc/systemd/system/scrutiny-collector.timer"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
ynh_restore_file --origin_path="/var/log/$app"
|
||||
ynh_restore "/etc/logrotate.d/$app"
|
||||
ynh_restore "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# 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..."
|
||||
|
||||
systemctl daemon-reload
|
||||
ynh_systemd_action --service_name="nginx" --action="reload"
|
||||
ynh_systemctl --service="nginx" --action="reload"
|
||||
|
||||
ynh_systemd_action --service_name="influxdb" --action="enable"
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_systemctl --service="influxdb" --action="enable"
|
||||
ynh_systemctl --service="influxdb" --action="start"
|
||||
|
||||
systemctl enable "/etc/systemd/system/scrutiny-web-server.service" --quiet
|
||||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log" --test_status="systemctl show scrutiny-web-server.service -p ActiveState --value | grep -v failed"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="enable"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,35 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_secure_remove --file="$install_dir/bin/scrutiny-web-linux-$YNH_ARCH"
|
||||
ynh_secure_remove --file="$install_dir/bin/scrutiny-collector-metrics-linux-$YNH_ARCH"
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
ynh_safe_rm "$install_dir/bin/scrutiny-web-linux-$YNH_ARCH"
|
||||
ynh_safe_rm "$install_dir/bin/scrutiny-collector-metrics-linux-$YNH_ARCH"
|
||||
|
||||
#=================================================
|
||||
# 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="influxdb" --action="stop"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="stop" --log_path="/var/log/$app/web-server.log"
|
||||
ynh_systemctl --service="influxdb" --action="stop"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="stop" --log_path="/var/log/$app/web-server.log"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="stop" --log_path="/var/log/$app/collector.log"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="stop" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -38,7 +28,7 @@ fi
|
|||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
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
|
||||
ynh_setup_source --source_id="main" --dest_dir="$install_dir/bin"
|
||||
|
@ -48,27 +38,27 @@ ynh_setup_source --source_id="scrutiny-web-frontend" --dest_dir="$install_dir/we
|
|||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
ynh_add_systemd_config --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
|
||||
ynh_config_add_systemd --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
|
||||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log" --test_status="systemctl show scrutiny-web-server.service -p ActiveState --value | grep -v failed"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
ynh_config_add --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
|
||||
fi
|
||||
|
||||
ynh_use_logrotate --specific_user="$app" --non-append
|
||||
ynh_config_add_logrotate
|
||||
|
||||
#=================================================
|
||||
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS, ...)
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
ynh_script_progression "Updating configuration..."
|
||||
|
||||
if [ "${path}" == "/" ]
|
||||
then
|
||||
|
@ -76,10 +66,10 @@ then
|
|||
else
|
||||
base_path="${path}"
|
||||
fi
|
||||
ynh_add_config --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
|
||||
ynh_config_add --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
|
||||
ynh_add_config --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
|
||||
ynh_config_add --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
|
||||
ynh_config_add --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
|
||||
|
||||
#=================================================
|
||||
# SET FILE OWNERSHIP / PERMISSIONS
|
||||
|
@ -90,23 +80,23 @@ myynh_set_permissions
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
ynh_systemd_action --service_name="influxdb" --action="enable"
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_systemctl --service="influxdb" --action="enable"
|
||||
ynh_systemctl --service="influxdb" --action="start"
|
||||
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="enable"
|
||||
ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="enable"
|
||||
ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Reference in a new issue