mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
45 lines
809 B
Bash
Executable file
45 lines
809 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
do_pre_regen() {
|
|
pending_dir=$1
|
|
|
|
cd /usr/share/yunohost/templates/ssh
|
|
|
|
# only overwrite SSH configuration on an ISO installation
|
|
if [[ ! -f /etc/yunohost/from_script ]]; then
|
|
# do not listen to IPv6 if unavailable
|
|
[[ -f /proc/net/if_inet6 ]] \
|
|
|| sed -i "s/ListenAddress ::/#ListenAddress ::/g" sshd_config
|
|
|
|
install -D -m 644 sshd_config "${pending_dir}/etc/ssh/sshd_config"
|
|
fi
|
|
}
|
|
|
|
do_post_regen() {
|
|
regen_conf_files=$1
|
|
|
|
if [[ ! -f /etc/yunohost/from_script ]]; then
|
|
[[ -z "$regen_conf_files" ]] \
|
|
|| sudo service ssh restart
|
|
fi
|
|
}
|
|
|
|
FORCE=${2:-0}
|
|
DRY_RUN=${3:-0}
|
|
|
|
case "$1" in
|
|
pre)
|
|
do_pre_regen $4
|
|
;;
|
|
post)
|
|
do_post_regen $4
|
|
;;
|
|
*)
|
|
echo "hook called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|