From c8255fbc0cad6c97c4d7c8097c0faa14679d326a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Wed, 13 Apr 2016 22:27:43 +0200 Subject: [PATCH] [enh] Update avahi-daemon, glances and nsswitch conf_regen hooks --- data/hooks/conf_regen-old/37-avahi-daemon | 19 -------------- data/hooks/conf_regen-old/40-glances | 19 -------------- data/hooks/conf_regen-old/46-nsswitch | 19 -------------- data/hooks/conf_regen/37-avahi-daemon | 32 +++++++++++++++++++++++ data/hooks/conf_regen/40-glances | 32 +++++++++++++++++++++++ data/hooks/conf_regen/46-nsswitch | 32 +++++++++++++++++++++++ 6 files changed, 96 insertions(+), 57 deletions(-) delete mode 100644 data/hooks/conf_regen-old/37-avahi-daemon delete mode 100644 data/hooks/conf_regen-old/40-glances delete mode 100644 data/hooks/conf_regen-old/46-nsswitch create mode 100755 data/hooks/conf_regen/37-avahi-daemon create mode 100755 data/hooks/conf_regen/40-glances create mode 100755 data/hooks/conf_regen/46-nsswitch diff --git a/data/hooks/conf_regen-old/37-avahi-daemon b/data/hooks/conf_regen-old/37-avahi-daemon deleted file mode 100644 index 0fed5217c..000000000 --- a/data/hooks/conf_regen-old/37-avahi-daemon +++ /dev/null @@ -1,19 +0,0 @@ -set -e - -force=$1 - -function safe_copy () { - if [[ "$force" == "True" ]]; then - sudo yunohost service safecopy \ - -s avahi-daemon $1 $2 --force - else - sudo yunohost service safecopy \ - -s avahi-daemon $1 $2 - fi -} - -cd /usr/share/yunohost/templates/avahi-daemon - -if [[ "$(safe_copy avahi-daemon.conf /etc/avahi/avahi-daemon.conf | tail -n1)" == "True" ]]; then - sudo service avahi-daemon restart -fi diff --git a/data/hooks/conf_regen-old/40-glances b/data/hooks/conf_regen-old/40-glances deleted file mode 100644 index a1bec3dbe..000000000 --- a/data/hooks/conf_regen-old/40-glances +++ /dev/null @@ -1,19 +0,0 @@ -set -e - -force=$1 - -function safe_copy () { - if [[ "$force" == "True" ]]; then - sudo yunohost service safecopy \ - -s glances $1 $2 --force - else - sudo yunohost service safecopy \ - -s glances $1 $2 - fi -} - -cd /usr/share/yunohost/templates/glances - -if [[ "$(safe_copy glances.default /etc/default/glances | tail -n1)" == "True" ]]; then - sudo service glances restart -fi diff --git a/data/hooks/conf_regen-old/46-nsswitch b/data/hooks/conf_regen-old/46-nsswitch deleted file mode 100644 index 92f34b249..000000000 --- a/data/hooks/conf_regen-old/46-nsswitch +++ /dev/null @@ -1,19 +0,0 @@ -set -e - -force=$1 - -function safe_copy () { - if [[ "$force" == "True" ]]; then - sudo yunohost service safecopy \ - -s nsswitch $1 $2 --force - else - sudo yunohost service safecopy \ - -s nsswitch $1 $2 - fi -} - -cd /usr/share/yunohost/templates/nsswitch - -if [[ "$(safe_copy nsswitch.conf /etc/nsswitch.conf | tail -n1)" == "True" ]]; then - sudo service nscd restart -fi diff --git a/data/hooks/conf_regen/37-avahi-daemon b/data/hooks/conf_regen/37-avahi-daemon new file mode 100755 index 000000000..bbf290576 --- /dev/null +++ b/data/hooks/conf_regen/37-avahi-daemon @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +do_pre_regen() { + pending_dir=$1 + + cd /usr/share/yunohost/templates/avahi-daemon + + install -D avahi-daemon.conf "${pending_dir}/etc/avahi/avahi-daemon.conf" +} + +do_post_regen() { + sudo service avahi-daemon restart +} + +FORCE=$2 + +case "$1" in + pre) + do_pre_regen $3 + ;; + post) + do_post_regen + ;; + *) + echo "hook called with unknown argument \`$status'" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/data/hooks/conf_regen/40-glances b/data/hooks/conf_regen/40-glances new file mode 100755 index 000000000..73558338c --- /dev/null +++ b/data/hooks/conf_regen/40-glances @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +do_pre_regen() { + pending_dir=$1 + + cd /usr/share/yunohost/templates/glances + + install -D glances.default "${pending_dir}/etc/default/glances" +} + +do_post_regen() { + sudo service glances restart +} + +FORCE=$2 + +case "$1" in + pre) + do_pre_regen $3 + ;; + post) + do_post_regen + ;; + *) + echo "hook called with unknown argument \`$status'" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/data/hooks/conf_regen/46-nsswitch b/data/hooks/conf_regen/46-nsswitch new file mode 100755 index 000000000..f6ced70f3 --- /dev/null +++ b/data/hooks/conf_regen/46-nsswitch @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +do_pre_regen() { + pending_dir=$1 + + cd /usr/share/yunohost/templates/nsswitch + + install -D nsswitch.conf "${pending_dir}/etc/nsswitch.conf" +} + +do_post_regen() { + sudo service nscd restart +} + +FORCE=$2 + +case "$1" in + pre) + do_pre_regen $3 + ;; + post) + do_post_regen + ;; + *) + echo "hook called with unknown argument \`$status'" >&2 + exit 1 + ;; +esac + +exit 0