mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
7c45b5268c
commit
a57af508f4
10 changed files with 187 additions and 205 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -4,3 +4,6 @@
|
|||
.directory
|
||||
|
||||
*swp
|
||||
*~
|
||||
*.sw[op]
|
||||
.DS_Store
|
||||
|
|
|
@ -20,7 +20,8 @@ code = "https://github.com/mikaku/Monitorix"
|
|||
cpe = "cpe:2.3:a:fibranet:monitorix"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2.20"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
|
@ -51,6 +52,7 @@ ram.runtime = "50M"
|
|||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
group = "www-data:r-x"
|
||||
dir = "/opt/yunohost/__APP__"
|
||||
owner = "__APP__:rwx"
|
||||
group = "www-data:rx"
|
||||
|
|
|
@ -16,7 +16,7 @@ readonly var_list_to_manage='mysql_installed postgresql_installed memcached_inst
|
|||
installed_php_fpm_filter() {
|
||||
while read -r item; do
|
||||
local version=${item%,*}
|
||||
if ynh_package_is_installed --package=php"$version"-fpm; then
|
||||
if _ynh_apt_package_is_installedphp"$version"-fpm; then
|
||||
echo "$item"
|
||||
fi
|
||||
done
|
||||
|
@ -45,27 +45,27 @@ load_vars() {
|
|||
# This function is called by the hook in install/upgrade/remove yunohost operation
|
||||
# We we need to ensure that this function the quickest as possible
|
||||
# Note that we don't use the yunohost command intentionally for optimization
|
||||
if ynh_package_is_installed --package=mysql || ynh_package_is_installed --package=mariadb-server; then
|
||||
if _ynh_apt_package_is_installedmysql || _ynh_apt_package_is_installedmariadb-server; then
|
||||
readonly mysql_installed=true
|
||||
else
|
||||
readonly mysql_installed=false
|
||||
fi
|
||||
if ynh_package_is_installed --package=postgresql; then
|
||||
if _ynh_apt_package_is_installedpostgresql; then
|
||||
readonly postgresql_installed=true
|
||||
else
|
||||
readonly postgresql_installed=false
|
||||
fi
|
||||
if ynh_package_is_installed --package=memcached; then
|
||||
if _ynh_apt_package_is_installedmemcached; then
|
||||
readonly memcached_installed=true
|
||||
else
|
||||
readonly memcached_installed=false
|
||||
fi
|
||||
if ynh_package_is_installed --package=redis-server; then
|
||||
if _ynh_apt_package_is_installedredis-server; then
|
||||
readonly redis_installed=true
|
||||
else
|
||||
readonly redis_installed=false
|
||||
fi
|
||||
if ynh_package_is_installed --package='php*-fpm'; then
|
||||
if _ynh_apt_package_is_installed'php*-fpm'; then
|
||||
readonly phpfpm_installed=true
|
||||
else
|
||||
readonly phpfpm_installed=false
|
||||
|
@ -149,7 +149,7 @@ EOF
|
|||
# Used by update_config_if_needed.sh hook
|
||||
save_vars_current_value() {
|
||||
for var in $var_list_to_manage; do
|
||||
ynh_app_setting_set --app="$app" --key="previous_$var" --value="${!var}"
|
||||
ynh_app_setting_set --key="previous_$var" --value="${!var}"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ install_monitorix_package() {
|
|||
ynh_setup_source --dest_dir="$tempdir" --source_id="main"
|
||||
|
||||
# Install the package
|
||||
ynh_package_install "$tempdir/monitorix.deb"
|
||||
_ynh_apt_install "$tempdir/monitorix.deb"
|
||||
cp -r /var/lib/monitorix/* "$data_dir"/
|
||||
}
|
||||
|
||||
|
@ -181,32 +181,32 @@ config_php_fpm() {
|
|||
for pool_dir_by_version in /etc/php/*; do
|
||||
pool_version=$(echo "$pool_dir_by_version" | cut -d/ -f4)
|
||||
pool_file="/etc/php/$pool_version/fpm/pool.d/${app}_status.conf"
|
||||
if ynh_package_is_installed --package="php$pool_version-fpm"; then
|
||||
ynh_add_config --jinja --template=_php_status.conf --destination="$pool_file"
|
||||
if _ynh_apt_package_is_installed"php$pool_version-fpm"; then
|
||||
ynh_config_add --jinja --template=_php_status.conf --destination="$pool_file"
|
||||
|
||||
chown root:root "$pool_file"
|
||||
chmod 444 "$pool_file"
|
||||
ynh_systemd_action --service_name="php$pool_version"-fpm.service --action=reload
|
||||
ynh_systemctl --service="php$pool_version"-fpm.service --action=reload
|
||||
else
|
||||
if [ -e "$pool_file" ]; then
|
||||
ynh_secure_remove --file="$pool_file"
|
||||
ynh_safe_rm "$pool_file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
configure_hooks() {
|
||||
ynh_replace_string --match_string=__APP__ --replace_string="$app" --target_file=../hooks/post_iptable_rules
|
||||
ynh_replace_string --match_string=__INSTALL_DIR__ --replace_string="$install_dir" --target_file=../hooks/post_app_install
|
||||
ynh_replace_string --match_string=__INSTALL_DIR__ --replace_string="$install_dir" --target_file=../hooks/post_app_remove
|
||||
ynh_replace_string --match_string=__INSTALL_DIR__ --replace_string="$install_dir" --target_file=../hooks/post_app_upgrade
|
||||
ynh_replace --match=__APP__ --replace="$app" --file=../hooks/post_iptable_rules
|
||||
ynh_replace --match=__INSTALL_DIR__ --replace="$install_dir" --file=../hooks/post_app_install
|
||||
ynh_replace --match=__INSTALL_DIR__ --replace="$install_dir" --file=../hooks/post_app_remove
|
||||
ynh_replace --match=__INSTALL_DIR__ --replace="$install_dir" --file=../hooks/post_app_upgrade
|
||||
|
||||
cp ../sources/update_config_if_needed.sh "$install_dir"/
|
||||
ynh_replace_string --match_string=__APP__ --replace_string="$app" --target_file="$install_dir"/update_config_if_needed.sh
|
||||
ynh_replace --match=__APP__ --replace="$app" --file="$install_dir"/update_config_if_needed.sh
|
||||
}
|
||||
|
||||
configure_alerts_email() {
|
||||
ynh_add_config --template=monitorix-alert.sh --destination="$install_dir"/monitorix-alert.sh
|
||||
ynh_config_add --template=monitorix-alert.sh --destination="$install_dir"/monitorix-alert.sh
|
||||
for alias_file in system.loadavg-alert.sh \
|
||||
fs.loadavg-alert.sh \
|
||||
mail.mqueued-alert.sh \
|
||||
|
@ -215,7 +215,7 @@ configure_alerts_email() {
|
|||
alias_path="$install_dir/$alias_file"
|
||||
if [ ! -h "$alias_path" ]; then
|
||||
if [ -e "$alias_path" ]; then
|
||||
ynh_secure_remove --file="$alias_path"
|
||||
ynh_safe_rm "$alias_path"
|
||||
fi
|
||||
ln -s "$install_dir/monitorix-alert.sh" "$install_dir/$alias_file"
|
||||
fi
|
||||
|
@ -223,154 +223,189 @@ configure_alerts_email() {
|
|||
}
|
||||
|
||||
ensure_vars_set() {
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=db_pwd --value="$(ynh_string_random --length=12)"
|
||||
if [ -z "${db_pwd:-}" ]; then
|
||||
db_pwd="$(ynh_string_random 12)"
|
||||
ynh_app_setting_set --app="$app" --key=db_pwd --value="$db_pwd"
|
||||
db_pwd="$(ynh_string_random --length=12)"
|
||||
ynh_app_setting_set --key=db_pwd --value="$db_pwd"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=alerts_email --value="admins@$domain"
|
||||
if [ -z "${alerts_email:-}" ]; then
|
||||
alerts_email="admins@$domain"
|
||||
ynh_app_setting_set --app="$app" --key=alerts_email --value="$alerts_email"
|
||||
ynh_app_setting_set --key=alerts_email --value="$alerts_email"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_hourly_view --value=n
|
||||
if [ -z "${enable_hourly_view:-}" ]; then
|
||||
enable_hourly_view=n
|
||||
ynh_app_setting_set --app="$app" --key=enable_hourly_view --value="$enable_hourly_view"
|
||||
ynh_app_setting_set --key=enable_hourly_view --value="$enable_hourly_view"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=image_format --value=svg
|
||||
if [ -z "${image_format:-}" ]; then
|
||||
image_format=svg
|
||||
ynh_app_setting_set --app="$app" --key=image_format --value="$image_format"
|
||||
ynh_app_setting_set --key=image_format --value="$image_format"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=theme_color --value=black
|
||||
if [ -z "${theme_color:-}" ]; then
|
||||
theme_color=black
|
||||
ynh_app_setting_set --app="$app" --key=theme_color --value="$theme_color"
|
||||
ynh_app_setting_set --key=theme_color --value="$theme_color"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=max_historic_years --value=5
|
||||
if [ -z "${max_historic_years:-}" ]; then
|
||||
max_historic_years=5
|
||||
ynh_app_setting_set --app="$app" --key=max_historic_years --value="$max_historic_years"
|
||||
ynh_app_setting_set --key=max_historic_years --value="$max_historic_years"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=process_priority --value=0
|
||||
if [ -z "${process_priority:-}" ]; then
|
||||
process_priority=0
|
||||
ynh_app_setting_set --app="$app" --key=process_priority --value="$process_priority"
|
||||
ynh_app_setting_set --key=process_priority --value="$process_priority"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=system_alerts_loadavg_enabled --value=n
|
||||
if [ -z "${system_alerts_loadavg_enabled:-}" ]; then
|
||||
system_alerts_loadavg_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=system_alerts_loadavg_enabled --value="$system_alerts_loadavg_enabled"
|
||||
ynh_app_setting_set --key=system_alerts_loadavg_enabled --value="$system_alerts_loadavg_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=system_alerts_loadavg_timeintvl --value=3600
|
||||
if [ -z "${system_alerts_loadavg_timeintvl:-}" ]; then
|
||||
system_alerts_loadavg_timeintvl=3600
|
||||
ynh_app_setting_set --app="$app" --key=system_alerts_loadavg_timeintvl --value="$system_alerts_loadavg_timeintvl"
|
||||
ynh_app_setting_set --key=system_alerts_loadavg_timeintvl --value="$system_alerts_loadavg_timeintvl"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=system_alerts_loadavg_threshold --value=5.0
|
||||
if [ -z "${system_alerts_loadavg_threshold:-}" ]; then
|
||||
system_alerts_loadavg_threshold=5.0
|
||||
ynh_app_setting_set --app="$app" --key=system_alerts_loadavg_threshold --value="$system_alerts_loadavg_threshold"
|
||||
ynh_app_setting_set --key=system_alerts_loadavg_threshold --value="$system_alerts_loadavg_threshold"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=disk_alerts_loadavg_enabled --value=false
|
||||
if [ -z "${disk_alerts_loadavg_enabled:-}" ]; then
|
||||
disk_alerts_loadavg_enabled=false
|
||||
ynh_app_setting_set --app="$app" --key=disk_alerts_loadavg_enabled --value="$disk_alerts_loadavg_enabled"
|
||||
ynh_app_setting_set --key=disk_alerts_loadavg_enabled --value="$disk_alerts_loadavg_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=disk_alerts_loadavg_timeintvl --value=3600
|
||||
if [ -z "${disk_alerts_loadavg_timeintvl:-}" ]; then
|
||||
disk_alerts_loadavg_timeintvl=3600
|
||||
ynh_app_setting_set --app="$app" --key=disk_alerts_loadavg_timeintvl --value="$disk_alerts_loadavg_timeintvl"
|
||||
ynh_app_setting_set --key=disk_alerts_loadavg_timeintvl --value="$disk_alerts_loadavg_timeintvl"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=disk_alerts_loadavg_threshold --value=98
|
||||
if [ -z "${disk_alerts_loadavg_threshold:-}" ]; then
|
||||
disk_alerts_loadavg_threshold=98
|
||||
ynh_app_setting_set --app="$app" --key=disk_alerts_loadavg_threshold --value="$disk_alerts_loadavg_threshold"
|
||||
ynh_app_setting_set --key=disk_alerts_loadavg_threshold --value="$disk_alerts_loadavg_threshold"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_delvd_enabled --value=n
|
||||
if [ -z "${mail_delvd_enabled:-}" ]; then
|
||||
mail_delvd_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=mail_delvd_enabled --value="$mail_delvd_enabled"
|
||||
ynh_app_setting_set --key=mail_delvd_enabled --value="$mail_delvd_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_delvd_timeintvl --value=60
|
||||
if [ -z "${mail_delvd_timeintvl:-}" ]; then
|
||||
mail_delvd_timeintvl=60
|
||||
ynh_app_setting_set --app="$app" --key=mail_delvd_timeintvl --value="$mail_delvd_timeintvl"
|
||||
ynh_app_setting_set --key=mail_delvd_timeintvl --value="$mail_delvd_timeintvl"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_delvd_threshold --value=100
|
||||
if [ -z "${mail_delvd_threshold:-}" ]; then
|
||||
mail_delvd_threshold=100
|
||||
ynh_app_setting_set --app="$app" --key=mail_delvd_threshold --value="$mail_delvd_threshold"
|
||||
ynh_app_setting_set --key=mail_delvd_threshold --value="$mail_delvd_threshold"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_mqueued_enabled --value=n
|
||||
if [ -z "${mail_mqueued_enabled:-}" ]; then
|
||||
mail_mqueued_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=mail_mqueued_enabled --value="$mail_mqueued_enabled"
|
||||
ynh_app_setting_set --key=mail_mqueued_enabled --value="$mail_mqueued_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_mqueued_timeintvl --value=3600
|
||||
if [ -z "${mail_mqueued_timeintvl:-}" ]; then
|
||||
mail_mqueued_timeintvl=3600
|
||||
ynh_app_setting_set --app="$app" --key=mail_mqueued_timeintvl --value="$mail_mqueued_timeintvl"
|
||||
ynh_app_setting_set --key=mail_mqueued_timeintvl --value="$mail_mqueued_timeintvl"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_mqueued_threshold --value=100
|
||||
if [ -z "${mail_mqueued_threshold:-}" ]; then
|
||||
mail_mqueued_threshold=100
|
||||
ynh_app_setting_set --app="$app" --key=mail_mqueued_threshold --value="$mail_mqueued_threshold"
|
||||
ynh_app_setting_set --key=mail_mqueued_threshold --value="$mail_mqueued_threshold"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_enabled --value=n
|
||||
if [ -z "${emailreports_enabled:-}" ]; then
|
||||
emailreports_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_enabled --value="$emailreports_enabled"
|
||||
ynh_app_setting_set --key=emailreports_enabled --value="$emailreports_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_subject_prefix --value='Monitorix:'
|
||||
if [ -z "${emailreports_subject_prefix:-}" ]; then
|
||||
emailreports_subject_prefix='Monitorix:'
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_subject_prefix --value="$emailreports_subject_prefix"
|
||||
ynh_app_setting_set --key=emailreports_subject_prefix --value="$emailreports_subject_prefix"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_hour --value=0
|
||||
if [ -z "${emailreports_hour:-}" ]; then
|
||||
emailreports_hour=0
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_hour --value="$emailreports_hour"
|
||||
ynh_app_setting_set --key=emailreports_hour --value="$emailreports_hour"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_minute --value=0
|
||||
if [ -z "${emailreports_minute:-}" ]; then
|
||||
emailreports_minute=0
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_minute --value="$emailreports_minute"
|
||||
ynh_app_setting_set --key=emailreports_minute --value="$emailreports_minute"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_daily_enabled --value=n
|
||||
if [ -z "${emailreports_daily_enabled:-}" ]; then
|
||||
emailreports_daily_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_daily_enabled --value="$emailreports_daily_enabled"
|
||||
ynh_app_setting_set --key=emailreports_daily_enabled --value="$emailreports_daily_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_daily_graphs --value='system,fs'
|
||||
if [ -z "${emailreports_daily_graphs:-}" ]; then
|
||||
emailreports_daily_graphs='system,fs'
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_daily_graphs --value="$emailreports_daily_graphs"
|
||||
ynh_app_setting_set --key=emailreports_daily_graphs --value="$emailreports_daily_graphs"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_daily_to --value="admins@$domain"
|
||||
if [ -z "${emailreports_daily_to:-}" ]; then
|
||||
emailreports_daily_to="admins@$domain"
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_daily_to --value="$emailreports_daily_to"
|
||||
ynh_app_setting_set --key=emailreports_daily_to --value="$emailreports_daily_to"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_weekly_enabled --value=n
|
||||
if [ -z "${emailreports_weekly_enabled:-}" ]; then
|
||||
emailreports_weekly_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_weekly_enabled --value="$emailreports_weekly_enabled"
|
||||
ynh_app_setting_set --key=emailreports_weekly_enabled --value="$emailreports_weekly_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_weekly_graphs --value='system,fs'
|
||||
if [ -z "${emailreports_weekly_graphs:-}" ]; then
|
||||
emailreports_weekly_graphs='system,fs'
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_weekly_graphs --value="$emailreports_weekly_graphs"
|
||||
ynh_app_setting_set --key=emailreports_weekly_graphs --value="$emailreports_weekly_graphs"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_weekly_to --value="admins@$domain"
|
||||
if [ -z "${emailreports_weekly_to:-}" ]; then
|
||||
emailreports_weekly_to="admins@$domain"
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_weekly_to --value="$emailreports_weekly_to"
|
||||
ynh_app_setting_set --key=emailreports_weekly_to --value="$emailreports_weekly_to"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_monthly_enabled --value=n
|
||||
if [ -z "${emailreports_monthly_enabled:-}" ]; then
|
||||
emailreports_monthly_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_monthly_enabled --value="$emailreports_monthly_enabled"
|
||||
ynh_app_setting_set --key=emailreports_monthly_enabled --value="$emailreports_monthly_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_monthly_graphs --value='system,fs'
|
||||
if [ -z "${emailreports_monthly_graphs:-}" ]; then
|
||||
emailreports_monthly_graphs='system,fs'
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_monthly_graphs --value="$emailreports_monthly_graphs"
|
||||
ynh_app_setting_set --key=emailreports_monthly_graphs --value="$emailreports_monthly_graphs"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_monthly_to --value="admins@$domain"
|
||||
if [ -z "${emailreports_monthly_to:-}" ]; then
|
||||
emailreports_monthly_to="admins@$domain"
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_monthly_to --value="$emailreports_monthly_to"
|
||||
ynh_app_setting_set --key=emailreports_monthly_to --value="$emailreports_monthly_to"
|
||||
fi
|
||||
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_yearly_enabled --value=n
|
||||
if [ -z "${emailreports_yearly_enabled:-}" ]; then
|
||||
emailreports_yearly_enabled=n
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_yearly_enabled --value="$emailreports_yearly_enabled"
|
||||
ynh_app_setting_set --key=emailreports_yearly_enabled --value="$emailreports_yearly_enabled"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_yearly_graphs --value='system,fs'
|
||||
if [ -z "${emailreports_yearly_graphs:-}" ]; then
|
||||
emailreports_yearly_graphs='system,fs'
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_yearly_graphs --value="$emailreports_yearly_graphs"
|
||||
ynh_app_setting_set --key=emailreports_yearly_graphs --value="$emailreports_yearly_graphs"
|
||||
fi
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_yearly_to --value="admins@$domain"
|
||||
if [ -z "${emailreports_yearly_to:-}" ]; then
|
||||
emailreports_yearly_to="admins@$domain"
|
||||
ynh_app_setting_set --app="$app" --key=emailreports_yearly_to --value="$emailreports_yearly_to"
|
||||
ynh_app_setting_set --key=emailreports_yearly_to --value="$emailreports_yearly_to"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -379,17 +414,17 @@ set_permission() {
|
|||
chmod u=rX,g=rwX,o= -R /etc/monitorix
|
||||
chown www-data:root -R "$nginx_status_conf"
|
||||
chmod u=r,g=r,o= "$nginx_status_conf"
|
||||
chown "$app":root "$install_dir"
|
||||
chmod u=rwX,g=rwX,o= -R "$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 "$app":root "$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 u=rwX,g=rwX,o= -R "$install_dir"
|
||||
chmod 750 "$install_dir"/monitorix-alert.sh
|
||||
chown "$app":root -R /var/log/"$app"
|
||||
chmod u=rwX,g=rwX,o= -R /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 "$app":root -R /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 | chmod u=rwX,g=rwX,o= -R /var/log/"$app"
|
||||
|
||||
chmod u=rwx,g=rx,o= "$data_dir"
|
||||
chown "$app":www-data "$data_dir"
|
||||
|
||||
chmod u=rwx,g=rx,o= "$data_dir"/*.rrd || true
|
||||
chown "$app":root "$data_dir"/*.rrd || true
|
||||
#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 u=rwx,g=rx,o= "$data_dir"/*.rrd || true
|
||||
#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":root "$data_dir"/*.rrd || true
|
||||
find "$data_dir"/{reports,usage} \( \! -perm -o= \
|
||||
-o \! -user "$app" \
|
||||
-o \! -group "$app" \) \
|
||||
|
|
|
@ -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 ../settings/scripts/experimental_helper.sh
|
||||
|
@ -16,24 +10,21 @@ load_vars
|
|||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
if systemctl is-active "$app".service --quiet; then
|
||||
ynh_print_warn --message="It's highly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'"
|
||||
ynh_print_warn "It's highly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# 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 NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/$app/"
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup --src_path="$nginx_status_conf"
|
||||
ynh_backup "/etc/$app/"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "$nginx_status_conf"
|
||||
|
||||
ynh_print_info --message="Backing up code..."
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_print_info "Backing up code..."
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
|
@ -41,16 +32,16 @@ ynh_backup --src_path="$install_dir"
|
|||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
ynh_backup "/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$data_dir" --is_big=1
|
||||
ynh_backup "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# 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,47 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
load_vars
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
ynh_add_config --jinja --template=monitorix.conf --destination=/etc/monitorix/monitorix.conf
|
||||
ynh_script_progression "Updating configuration..."
|
||||
ynh_config_add --jinja --template=monitorix.conf --destination=/etc/monitorix/monitorix.conf
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path='systemd' --line_match=' - Ok, ready.'
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
ynh_systemctl --service="$app" --action=start --log_path='systemd' --wait_until=' - Ok, ready.'
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -8,16 +8,14 @@
|
|||
source ./_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
ynh_app_config_apply() {
|
||||
_ynh_app_config_apply
|
||||
load_vars
|
||||
ynh_add_config --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf"
|
||||
ynh_config_add --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf"
|
||||
save_vars_current_value
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_app_config_run "$1"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
load_vars
|
||||
|
@ -18,33 +12,33 @@ ensure_vars_set
|
|||
|
||||
if [ -n "$(ls -A "$data_dir")" ]; then
|
||||
old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')"
|
||||
ynh_print_warn --message="Data directory was not empty. Data was moved to $old_data_dir_path"
|
||||
ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path"
|
||||
mkdir -p "$old_data_dir_path"
|
||||
mv -t "$old_data_dir_path" "$data_dir"/*
|
||||
app_data_dirs="$(echo /home/yunohost.app/*)"
|
||||
fi
|
||||
mkdir -p /var/log/"$app"
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
|
||||
ynh_systemctl --service="$app" --action=stop --log_path=systemd --timeout=15
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================ç
|
||||
ynh_script_progression --message="Adding configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Adding configurations related to $app..."
|
||||
|
||||
mkdir -p /etc/monitorix
|
||||
ynh_add_config --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf"
|
||||
ynh_add_config --jinja --template=nginx_status.conf --destination="$nginx_status_conf"
|
||||
ynh_config_add --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf"
|
||||
ynh_config_add --jinja --template=nginx_status.conf --destination="$nginx_status_conf"
|
||||
|
||||
ynh_add_nginx_config
|
||||
ynh_add_systemd_config
|
||||
ynh_config_add_nginx
|
||||
ynh_config_add_systemd
|
||||
|
||||
yunohost service add "$app" --description=Monitorix --log=systemd
|
||||
|
||||
ynh_script_progression --message="Configuring databases access..."
|
||||
ynh_script_progression "Configuring databases access..."
|
||||
configure_db
|
||||
|
||||
ynh_script_progression --message="Configuring php fpm access if needed..."
|
||||
ynh_script_progression "Configuring php fpm access if needed..."
|
||||
if "$phpfpm_installed"; then
|
||||
config_php_fpm
|
||||
fi
|
||||
|
@ -53,34 +47,30 @@ configure_hooks
|
|||
configure_alerts_email
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing packages..." --weight=1
|
||||
ynh_script_progression "Installing packages..."
|
||||
|
||||
# Download package and install it
|
||||
install_monitorix_package
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Protecting directory..."
|
||||
ynh_script_progression "Protecting directory..."
|
||||
|
||||
set_permission
|
||||
|
||||
ynh_use_logrotate --logfile="/var/log/$app"
|
||||
ynh_config_add_logrotate "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# 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='systemd' --line_match=' - Ok, ready.'
|
||||
ynh_systemctl --service="$app" --action="start" --log_path='systemd' --wait_until=' - Ok, ready.'
|
||||
# when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded
|
||||
ynh_systemd_action --service_name=nginx.service --action=restart
|
||||
ynh_systemctl --service=nginx.service --action=restart
|
||||
save_vars_current_value
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
load_vars
|
||||
|
@ -17,33 +11,33 @@ load_vars
|
|||
#=================================================
|
||||
|
||||
# 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
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=3
|
||||
ynh_script_progression "Removing $app service integration..."
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Removing system configurations related to $app..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --timeout=15
|
||||
ynh_systemctl --service="$app" --action="stop" --log_path="systemd" --timeout=15
|
||||
|
||||
ynh_secure_remove --file="$nginx_status_conf"
|
||||
ynh_remove_nginx_config
|
||||
ynh_safe_rm "$nginx_status_conf"
|
||||
ynh_config_remove_nginx
|
||||
|
||||
ynh_remove_systemd_config
|
||||
ynh_config_remove_systemd
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
ynh_config_remove_logrotate
|
||||
|
||||
for pool_dir_by_version in /etc/php/*; do
|
||||
pool_version=$(echo "$pool_dir_by_version" | cut -d/ -f4)
|
||||
pool_file="/etc/php/$pool_version/fpm/pool.d/${app}_status.conf"
|
||||
ynh_secure_remove --file="$pool_file"
|
||||
if ynh_package_is_installed --package="php$pool_version-fpm"; then
|
||||
ynh_systemd_action --service_name="php$pool_version"-fpm.service --action=reload
|
||||
ynh_safe_rm "$pool_file"
|
||||
if _ynh_apt_package_is_installed"php$pool_version-fpm"; then
|
||||
ynh_systemctl --service="php$pool_version"-fpm.service --action=reload
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -54,7 +48,7 @@ if ynh_mysql_user_exists --user="$db_user"; then
|
|||
ynh_mysql_drop_user "$db_user"
|
||||
fi
|
||||
|
||||
ynh_package_autopurge monitorix
|
||||
ynh_secure_remove --file="$install_dir"
|
||||
_ynh_apt autoremove --purge monitorix
|
||||
ynh_safe_rm "$install_dir"
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
#!/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 ../settings/scripts/experimental_helper.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
load_vars
|
||||
|
||||
ynh_script_progression --message="Configuring databases access..."
|
||||
ynh_script_progression "Configuring databases access..."
|
||||
configure_db
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring files" --weight=1
|
||||
ynh_script_progression "Restoring files"
|
||||
|
||||
ynh_restore
|
||||
ynh_restore_everything
|
||||
mkdir -p /var/log/"$app"
|
||||
systemctl enable "$app".service --quiet
|
||||
|
||||
ynh_script_progression --message="Configuring php fpm access if needed..."
|
||||
ynh_script_progression "Configuring php fpm access if needed..."
|
||||
if "$phpfpm_installed"; then
|
||||
config_php_fpm
|
||||
fi
|
||||
|
@ -34,34 +28,30 @@ yunohost service add "$app" --description="Monitorix" --log="systemd"
|
|||
#=================================================
|
||||
# RESTORE THE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the dependencies..." --weight=1
|
||||
ynh_script_progression "Restoring the dependencies..."
|
||||
|
||||
install_monitorix_package
|
||||
ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
|
||||
ynh_systemctl --service="$app" --action=stop --log_path=systemd --timeout=15
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Protecting directory..."
|
||||
ynh_script_progression "Protecting directory..."
|
||||
|
||||
set_permission
|
||||
|
||||
ynh_use_logrotate --logfile="/var/log/$app"
|
||||
ynh_config_add_logrotate "/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..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path='systemd' --line_match=' - Ok, ready.'
|
||||
ynh_systemctl --service="$app" --action=start --log_path='systemd' --wait_until=' - Ok, ready.'
|
||||
# when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded
|
||||
ynh_systemd_action --service_name=nginx.service --action=restart
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=nginx.service --action=restart
|
||||
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,19 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
load_vars
|
||||
|
||||
upgrade_type="$(ynh_check_app_version_changed)"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# MIGRATION 5 : Manage old settings
|
||||
#=================================================
|
||||
|
@ -23,20 +13,20 @@ ensure_vars_set
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
# Fix issue on package deployement
|
||||
test -e /etc/monitorix/conf.d/00-debian.conf || touch /etc/monitorix/conf.d/00-debian.conf
|
||||
|
||||
# Remove old hook if exist
|
||||
ynh_secure_remove --file=/usr/share/yunohost/hooks/post_iptable_rules/50-"$app"
|
||||
ynh_safe_rm /usr/share/yunohost/hooks/post_iptable_rules/50-"$app"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
||||
|
@ -44,15 +34,16 @@ ynh_systemd_action --service_name="$app" --action=stop --log_path="/var/log/$app
|
|||
# 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
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||
install_monitorix_package
|
||||
fi
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
|
||||
ynh_systemctl --service="$app" --action=stop --log_path=systemd --timeout=15
|
||||
|
||||
#=================================================
|
||||
# MIGRATION 2
|
||||
|
@ -73,22 +64,22 @@ fi
|
|||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Upgrading configurations related to $app..."
|
||||
|
||||
ynh_add_config --jinja --template=monitorix.conf --destination=/etc/monitorix/monitorix.conf
|
||||
ynh_add_config --jinja --template=nginx_status.conf --destination="$nginx_status_conf"
|
||||
ynh_config_add --jinja --template=monitorix.conf --destination=/etc/monitorix/monitorix.conf
|
||||
ynh_config_add --jinja --template=nginx_status.conf --destination="$nginx_status_conf"
|
||||
if "$phpfpm_installed"; then
|
||||
config_php_fpm
|
||||
fi
|
||||
ynh_add_nginx_config
|
||||
ynh_add_systemd_config
|
||||
ynh_config_add_nginx
|
||||
ynh_config_add_systemd
|
||||
|
||||
yunohost service add "$app" --description=Monitorix --log=systemd
|
||||
|
||||
ynh_script_progression --message="Configuring databases access..."
|
||||
ynh_script_progression "Configuring databases access..."
|
||||
configure_db
|
||||
|
||||
ynh_script_progression --message="Configuring php fpm access if needed..."
|
||||
ynh_script_progression "Configuring php fpm access if needed..."
|
||||
if "$phpfpm_installed"; then
|
||||
config_php_fpm
|
||||
fi
|
||||
|
@ -97,26 +88,24 @@ configure_hooks
|
|||
configure_alerts_email
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Protecting directory..."
|
||||
ynh_script_progression "Protecting directory..."
|
||||
|
||||
set_permission
|
||||
|
||||
ynh_use_logrotate --logfile="/var/log/$app"
|
||||
ynh_config_add_logrotate "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# 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=systemd --line_match=' - Ok, ready.'
|
||||
ynh_systemctl --service="$app" --action=restart --log_path=systemd --wait_until=' - Ok, ready.'
|
||||
# when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded
|
||||
ynh_systemd_action --service_name=nginx.service --action=restart
|
||||
ynh_systemctl --service=nginx.service --action=restart
|
||||
save_vars_current_value
|
||||
|
||||
#=================================================
|
||||
# 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