Check if Avahi services directory exists and is writable

This commit is contained in:
Mikhail Novosyolov 2019-04-12 20:11:38 +03:00
parent 07d6ca5b5c
commit f7a578aaac
2 changed files with 10 additions and 1 deletions

View file

@ -12,6 +12,7 @@ load_vars(){
SSHD_CONFIG="${SSHD_CONFIG:-/etc/ssh/sshd_config}"
AVAHI_TEMPLATE="${AVAHI_TEMPLATE:-/etc/ssh/openssh_avahi.service}"
AVAHI_SERVICE="${AVAHI_SERVICE:-/etc/avahi/services/openssh.service}"
AVAHI_DIRECTORY="$(dirname "$AVAHI_SERVICE")"
LOCK_FILE="${LOCK_FILE:-/run/openssh-avahi-helper.marker}"
for i in "$SSHD_CONFIG" "$AVAHI_TEMPLATE"
do
@ -19,6 +20,14 @@ load_vars(){
echo "Config file ${i} cannot be read!"
return 1
fi
if [ ! -d "$AVAHI_DIRECTORY" ]; then
echo "Avahi is probably not installed, exiting."
exit 0
fi
if [ ! -w "$AVAHI_DIRECTORY" ]; then
echo "Error: Avahi service directory is not writable!"
return 1
fi
done
}

View file

@ -20,7 +20,7 @@
Summary: OpenSSH free Secure Shell (SSH) implementation
Name: openssh
Version: 7.9p1
Release: 9
Release: 10
License: BSD
Group: Networking/Remote access
Url: http://www.openssh.com/