mirror of
https://github.com/YunoHost-Apps/netdata_ynh.git
synced 2024-09-03 19:46:33 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
ab67b31861
commit
9365ed8bf6
8 changed files with 69 additions and 117 deletions
|
@ -23,7 +23,8 @@ not-totally-free-upstream.en = "Netdata now includes a dependencie to a UI which
|
|||
not-totally-free-upstream.fr = "Netdata inclut maintenant une dépendance à une interface utilisateur qui est sous une licence bizarre qui interdit la rétro-ingénierie ou la personnalisation. Voir : https://github.com/YunoHost/apps/pull/2519"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
# Configure NetData
|
||||
|
@ -28,9 +24,9 @@ configure_netdata() {
|
|||
netdata_add_yunohost_postgres_configuration
|
||||
|
||||
# Create netdata user to monitor MySQL (if needed)
|
||||
is_mysql_user_existing=$(ynh_mysql_execute_as_root --sql="select user from mysql.user where user = 'netdata';")
|
||||
is_mysql_user_existing=$(ynh_mysql_db_shell <<< "select user from mysql.user where user = 'netdata';")
|
||||
if [ -z "$is_mysql_user_existing" ] ; then
|
||||
ynh_mysql_execute_as_root --sql="create user 'netdata'@'localhost';
|
||||
ynh_mysql_db_shell <<< "create user 'netdata'@'localhost';
|
||||
grant usage on *.* to 'netdata'@'localhost' with grant option;
|
||||
flush privileges;"
|
||||
fi
|
||||
|
@ -75,7 +71,7 @@ EOF
|
|||
chgrp netdata $web_log_file
|
||||
# Manage upgrade case from python to go plugin
|
||||
if [ -f "$install_dir/etc/netdata/python.d/web_log.conf" ] ; then
|
||||
ynh_secure_remove --file="$install_dir/etc/netdata/python.d/web_log.conf"
|
||||
ynh_safe_rm "$install_dir/etc/netdata/python.d/web_log.conf"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -95,6 +91,6 @@ EOF
|
|||
chgrp netdata $postgres_file
|
||||
# Manage upgrade case from python to go plugin
|
||||
if [ -f "$install_dir/etc/netdata/python.d/postgres.conf" ] ; then
|
||||
ynh_secure_remove --file="$install_dir/etc/netdata/python.d/postgres.conf"
|
||||
ynh_safe_rm "$install_dir/etc/netdata/python.d/postgres.conf"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,34 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
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/etc/netdata"
|
||||
ynh_backup "$install_dir/etc/netdata"
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# 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,48 +1,38 @@
|
|||
#!/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="$app" --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemctl --service="$app" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
||||
# Change registry link
|
||||
ynh_replace_string --match_string="registry to announce = https://$old_domain$old_path" --replace_string="registry to announce = https://$new_domain$new_path" --target_file="$install_dir/etc/netdata/netdata.conf"
|
||||
ynh_replace --match="registry to announce = https://$old_domain$old_path" --replace="registry to announce = https://$new_domain$new_path" --file="$install_dir/etc/netdata/netdata.conf"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# 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="restart" --log_path="$install_dir/var/log/$app/error.log"
|
||||
ynh_systemctl --service="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=11
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
NETDATA_TMPDIR="$install_dir/netdata_install"
|
||||
|
@ -25,18 +19,18 @@ ynh_setup_source --source_id="go" --dest_dir="$GO_TMPDIR"
|
|||
#=================================================
|
||||
# BUILD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Executing Netdata installer..." --weight=10
|
||||
ynh_script_progression "Executing Netdata installer..."
|
||||
|
||||
export PATH="$GO_TMPDIR/bin:$PATH"
|
||||
export GOPATH="$GO_TMPDIR/go/"
|
||||
export HOME=${HOME:-"/root/"}
|
||||
pushd "$NETDATA_TMPDIR"
|
||||
# the installer.sh script will append "netdata" after the --install-prefix arg
|
||||
ynh_exec_warn_less ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
|
||||
ynh_hide_warnings ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
|
||||
popd
|
||||
|
||||
ynh_secure_remove --file=$NETDATA_TMPDIR
|
||||
ynh_secure_remove --file=$GO_TMPDIR
|
||||
ynh_safe_rm $NETDATA_TMPDIR
|
||||
ynh_safe_rm $GO_TMPDIR
|
||||
|
||||
# Specific configuration
|
||||
configure_netdata
|
||||
|
@ -44,23 +38,23 @@ configure_netdata
|
|||
#=================================================
|
||||
# NGINX 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
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
yunohost service add "$app" --description "Real-time performance and health monitoring" --log "$install_dir/var/log/netdata/error.log" "$install_dir/var/log/netdata/access.log" "$install_dir/var/log/netdata/debug.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
|
||||
ynh_systemctl --service="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,55 +1,49 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
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 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; then
|
||||
if ynh_hide_warnings yunohost service status "$app" >/dev/null; then
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="stop"
|
||||
ynh_systemctl --service="$app" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# UNINSTALLING NETDATA
|
||||
#=================================================
|
||||
ynh_script_progression --message="Uninstalling Netdata..." --weight=6
|
||||
ynh_script_progression "Uninstalling Netdata..."
|
||||
|
||||
# Kill all netdata processes (essentially what the official uninstaller does)
|
||||
pkill netdata
|
||||
pkill -U netdata
|
||||
|
||||
# Rm all files that netdata may have installed (this is copypasta of the official uninstaller script)
|
||||
ynh_secure_remove /etc/logrotate.d/netdata
|
||||
ynh_secure_remove /etc/systemd/system/netdata.service
|
||||
ynh_secure_remove /lib/systemd/system/netdata.service
|
||||
ynh_secure_remove /usr/lib/systemd/system/netdata.service
|
||||
ynh_secure_remove /etc/init.d/netdata
|
||||
ynh_secure_remove /etc/periodic/daily/netdata-updater
|
||||
ynh_secure_remove /etc/cron.daily/netdata-updater
|
||||
ynh_secure_remove "/usr/sbin/netdata"
|
||||
ynh_secure_remove "/usr/share/netdata"
|
||||
ynh_secure_remove "/usr/libexec/netdata"
|
||||
ynh_secure_remove "/var/lib/netdata"
|
||||
ynh_secure_remove "/var/cache/netdata"
|
||||
ynh_secure_remove "/etc/netdata"
|
||||
ynh_safe_rm /etc/logrotate.d/netdata
|
||||
ynh_safe_rm /etc/systemd/system/netdata.service
|
||||
ynh_safe_rm /lib/systemd/system/netdata.service
|
||||
ynh_safe_rm /usr/lib/systemd/system/netdata.service
|
||||
ynh_safe_rm /etc/init.d/netdata
|
||||
ynh_safe_rm /etc/periodic/daily/netdata-updater
|
||||
ynh_safe_rm /etc/cron.daily/netdata-updater
|
||||
ynh_safe_rm "/usr/sbin/netdata"
|
||||
ynh_safe_rm "/usr/share/netdata"
|
||||
ynh_safe_rm "/usr/libexec/netdata"
|
||||
ynh_safe_rm "/var/lib/netdata"
|
||||
ynh_safe_rm "/var/cache/netdata"
|
||||
ynh_safe_rm "/etc/netdata"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
@ -15,14 +9,14 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Netdata configuration directory..." --weight=1
|
||||
ynh_script_progression "Restoring Netdata configuration directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir/etc/netdata"
|
||||
ynh_restore "$install_dir/etc/netdata"
|
||||
|
||||
#=================================================
|
||||
# INSTALL AND RESTORE THE APP CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling Netdata..." --weight=18
|
||||
ynh_script_progression "Reinstalling Netdata..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
NETDATA_TMPDIR="$install_dir/netdata_install"
|
||||
|
@ -37,11 +31,11 @@ export GOPATH="$GO_TMPDIR/go/"
|
|||
export HOME=${HOME:-"/root/"}
|
||||
pushd "$NETDATA_TMPDIR"
|
||||
# the installer.sh script will append "netdata" after the --install-prefix arg
|
||||
ynh_exec_warn_less ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
|
||||
ynh_hide_warnings ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
|
||||
popd
|
||||
|
||||
ynh_secure_remove --file=$NETDATA_TMPDIR
|
||||
ynh_secure_remove --file=$GO_TMPDIR
|
||||
ynh_safe_rm $NETDATA_TMPDIR
|
||||
ynh_safe_rm $GO_TMPDIR
|
||||
|
||||
# Specific configuration
|
||||
configure_netdata
|
||||
|
@ -49,23 +43,23 @@ configure_netdata
|
|||
#=================================================
|
||||
# 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/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
yunohost service add "$app" --description "Real-time performance and health monitoring" --log "$install_dir/var/log/netdata/error.log" "$install_dir/var/log/netdata/access.log" "$install_dir/var/log/netdata/debug.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD 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="$app" --action="start" --log_path="$install_dir/var/log/$app/error.log"
|
||||
ynh_systemctl --service="$app" --action="start" --log_path="$install_dir/var/log/$app/error.log"
|
||||
|
||||
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" --last
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=18
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -26,8 +20,6 @@ GO_TMPDIR="$install_dir/go_install"
|
|||
mkdir -p $GO_TMPDIR
|
||||
ynh_setup_source --source_id="go" --dest_dir="$GO_TMPDIR"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
||||
# signal netdata to start saving its database
|
||||
|
@ -42,11 +34,11 @@ export GOPATH="$GO_TMPDIR/go/"
|
|||
export HOME=${HOME:-"/root/"}
|
||||
pushd "$NETDATA_TMPDIR"
|
||||
# the installer.sh script will append "netdata" after the --install-prefix arg
|
||||
ynh_exec_warn_less ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
|
||||
ynh_hide_warnings ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
|
||||
popd
|
||||
|
||||
ynh_secure_remove --file=$NETDATA_TMPDIR
|
||||
ynh_secure_remove --file=$GO_TMPDIR
|
||||
ynh_safe_rm $NETDATA_TMPDIR
|
||||
ynh_safe_rm $GO_TMPDIR
|
||||
|
||||
# Specific configuration
|
||||
configure_netdata
|
||||
|
@ -54,22 +46,22 @@ configure_netdata
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
yunohost service add "$app" --description "Real-time performance and health monitoring" --log "$install_dir/var/log/netdata/error.log" "$install_dir/var/log/netdata/access.log" "$install_dir/var/log/netdata/debug.log"
|
||||
|
||||
#=================================================
|
||||
# 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="restart" --log_path="$install_dir/var/log/$app/error.log"
|
||||
ynh_systemctl --service="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue