Merge pull request #479 from andres-erbsen/hostname-openbsd

__hostname: openbsd support
This commit is contained in:
Nico Schottelius 2016-09-03 20:37:41 +02:00 committed by GitHub
commit 7329b528f6
2 changed files with 13 additions and 3 deletions

View file

@ -40,7 +40,7 @@ case "$os" in
exit 0 exit 0
fi fi
;; ;;
scientific|centos) scientific|centos|openbsd)
if [ "$name_sysconfig" = "$name_should" -a "$name_running" = "$name_should" ]; then if [ "$name_sysconfig" = "$name_should" -a "$name_running" = "$name_should" ]; then
exit 0 exit 0
fi fi
@ -64,7 +64,7 @@ else
echo "hostname '$name_should'" echo "hostname '$name_should'"
echo "printf '%s\n' '$name_should' > /etc/hostname" echo "printf '%s\n' '$name_should' > /etc/hostname"
;; ;;
centos) centos|openbsd)
echo "hostname '$name_should'" echo "hostname '$name_should'"
;; ;;
suse) suse)

View file

@ -23,7 +23,14 @@ os=$(cat "$__global/explorer/os")
if [ -f "$__object/parameter/name" ]; then if [ -f "$__object/parameter/name" ]; then
name_should="$(cat "$__object/parameter/name")" name_should="$(cat "$__object/parameter/name")"
else else
name_should="$(echo "${__target_host%%.*}")" case "$os" in
openbsd)
name_should="$(echo "${__target_host}")"
;;
*)
name_should="$(echo "${__target_host%%.*}")"
;;
esac
fi fi
@ -45,6 +52,9 @@ case "$os" in
--key HOSTNAME \ --key HOSTNAME \
--value "$name_should" --exact_delimiter --value "$name_should" --exact_delimiter
;; ;;
openbsd)
echo "$name_should" | __file /etc/myname --source -
;;
*) *)
not_supported not_supported
;; ;;