diff --git a/data/hooks/conf_regen-old/09-nslcd b/data/hooks/conf_regen-old/09-nslcd deleted file mode 100644 index de377e997..000000000 --- a/data/hooks/conf_regen-old/09-nslcd +++ /dev/null @@ -1,26 +0,0 @@ -set -e - -force=$1 - -function safe_copy () { - if [[ "$force" == "True" ]]; then - sudo yunohost service safecopy \ - -s nslcd \ - $1 $2 \ - --force - else - sudo yunohost service safecopy \ - -s nslcd \ - $1 $2 - fi -} - -cd /usr/share/yunohost/templates/nslcd - -safe_copy nslcd.conf /etc/nslcd.conf - -# Fix: Add a blank line at the end of the file -# to avoid nscld restart failure -echo -e "\n" | sudo tee -a /etc/nslcd.conf - -sudo service nslcd restart diff --git a/data/hooks/conf_regen/09-nslcd b/data/hooks/conf_regen/09-nslcd new file mode 100755 index 000000000..e9239ca48 --- /dev/null +++ b/data/hooks/conf_regen/09-nslcd @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +do_pre_regen() { + pending_dir=$1 + + cd /usr/share/yunohost/templates/nslcd + + install -D nslcd.conf "${pending_dir}/etc/nslcd.conf" +} + +do_post_regen() { + sudo service nslcd 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