mirror of
https://github.com/YunoHost-Apps/biboumi_ynh.git
synced 2024-09-03 18:15:58 +02:00
Programmatic path to the metronome config dir
This commit is contained in:
parent
1228758e80
commit
132c21b35e
6 changed files with 27 additions and 8 deletions
|
@ -8,6 +8,22 @@
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
_get_metronome_config_dir() {
|
||||||
|
if [[ $YNH_DEBIAN_VERSION == "bullseye" ]]; then
|
||||||
|
echo "/etc/metronome/conf.d"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# multi_instance=false, there's only one
|
||||||
|
metronome_app=$(yunohost app list --json | jq '.apps[] | select(.id == "metronome")) | .id')
|
||||||
|
if (( ${#metronome_apps[@]} == 0 )); then
|
||||||
|
ynh_print_warn --message="Could not find any metronome app!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(yunohost app setting "$metronome_app" install_dir)/conf/conf.d"
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -27,7 +27,7 @@ ynh_backup --src_path="/etc/$app"
|
||||||
|
|
||||||
ynh_backup --src_path="/var/lib/$app"
|
ynh_backup --src_path="/var/lib/$app"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/metronome/conf.d/$app.cfg.lua"
|
ynh_backup --src_path="$(_get_metronome_config_dir)/$app.cfg.lua"
|
||||||
|
|
||||||
ynh_backup --src_path="/var/log/$app/"
|
ynh_backup --src_path="/var/log/$app/"
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,9 @@ ynh_script_progression --message="Adding $app's configuration files..." --weight
|
||||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
|
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
# Add metronome component
|
# Add metronome component
|
||||||
ynh_add_config --template="metronome.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua"
|
metronome_config_dir=$(_get_metronome_config_dir)
|
||||||
chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua"
|
ynh_add_config --template="metronome.cfg.lua" --destination="$metronome_config_dir/$app.cfg.lua"
|
||||||
|
chown metronome:metronome "$metronome_config_dir/$app.cfg.lua"
|
||||||
ynh_systemd_action --service_name="metronome" --action="restart"
|
ynh_systemd_action --service_name="metronome" --action="restart"
|
||||||
|
|
||||||
# Add biboumi configuration
|
# Add biboumi configuration
|
||||||
|
|
|
@ -36,7 +36,7 @@ ynh_secure_remove --file="/var/lib/$app"
|
||||||
ynh_secure_remove --file="/etc/$app"
|
ynh_secure_remove --file="/etc/$app"
|
||||||
|
|
||||||
# Remove Metronome component
|
# Remove Metronome component
|
||||||
ynh_secure_remove --file="/etc/metronome/conf.d/$app.cfg.lua"
|
ynh_secure_remove --file="$(_get_metronome_config_dir)/$app.cfg.lua"
|
||||||
ynh_systemd_action --action=restart --service_name=metronome
|
ynh_systemd_action --action=restart --service_name=metronome
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -33,8 +33,9 @@ ynh_script_progression --message="Restoring various files..."
|
||||||
ynh_restore_file --origin_path="/etc/$app"
|
ynh_restore_file --origin_path="/etc/$app"
|
||||||
chown -R _biboumi:_biboumi "/etc/$app"
|
chown -R _biboumi:_biboumi "/etc/$app"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/metronome/conf.d/$app.cfg.lua"
|
metronome_config_dir=$(_get_metronome_config_dir)
|
||||||
chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua"
|
ynh_restore_file --origin_path="$metronome_config_dir/$app.cfg.lua"
|
||||||
|
chown metronome:metronome "$metronome_config_dir/$app.cfg.lua"
|
||||||
ynh_systemd_action --service_name=metronome --action="restart"
|
ynh_systemd_action --service_name=metronome --action="restart"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -28,8 +28,9 @@ chown -R _biboumi:_biboumi "/var/lib/$app"
|
||||||
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
|
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
|
||||||
|
|
||||||
# Upgrade metronome component
|
# Upgrade metronome component
|
||||||
ynh_add_config --template="metronome.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua"
|
metronome_config_dir=$(_get_metronome_config_dir)
|
||||||
chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua"
|
ynh_add_config --template="metronome.cfg.lua" --destination="$metronome_config_dir/$app.cfg.lua"
|
||||||
|
chown metronome:metronome "$metronome_config_dir/$app.cfg.lua"
|
||||||
ynh_systemd_action --service_name=metronome --action="restart"
|
ynh_systemd_action --service_name=metronome --action="restart"
|
||||||
|
|
||||||
# Upgrade biboumi configuration
|
# Upgrade biboumi configuration
|
||||||
|
|
Loading…
Add table
Reference in a new issue