mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Update nslcd conf_regen hook and do not edit the file by hand
This commit is contained in:
parent
0f9e777fc6
commit
99002b9f42
2 changed files with 32 additions and 26 deletions
|
@ -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
|
|
32
data/hooks/conf_regen/09-nslcd
Executable file
32
data/hooks/conf_regen/09-nslcd
Executable file
|
@ -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
|
Loading…
Add table
Reference in a new issue