add freebsd support to a few types

This commit is contained in:
kamila 2018-03-25 21:27:43 +02:00
parent b740d415ca
commit 7d20eb9187
7 changed files with 57 additions and 4 deletions

View file

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

View file

@ -52,6 +52,13 @@ case "$os" in
--key HOSTNAME \
--value "$name_should" --exact_delimiter
;;
freebsd)
__key_value rcconf-hostname \
--file /etc/rc.conf \
--delimiter '=' \
--key 'hostname' \
--value "$name_should"
;;
openbsd)
echo "$name_should" | __file /etc/myname --source -
;;

View file

@ -64,6 +64,10 @@ else
state="present"
[ -f "/etc/runlevels/${target_runlevel}/${name}" ] || state="absent"
;;
freebsd)
state="absent"
service -e | grep "/$name$" && state="present"
;;
*)
echo "Unsupported os: $os" >&2
exit 1

View file

@ -77,6 +77,10 @@ case "$state_should" in
echo "update-rc.d \"$name\" defaults >/dev/null"
;;
freebsd)
: # handled in manifest
;;
*)
echo "Unsupported os: $os" >&2
exit 1

View file

@ -0,0 +1,28 @@
#!/bin/sh -e
state_should="$(cat "$__object/parameter/state")"
state_is=$(cat "$__object/explorer/state")
name="$__object_id"
# Short circuit if nothing is to be done
[ "$state_should" = "$state_is" ] && exit 0
os=$(cat "$__global/explorer/os")
case "$os" in
freebsd)
if [ "$state_should" == 'present' ]; then
value='YES'
else
value='NO'
fi
__key_value rcconf-$name-enable \
--file /etc/rc.conf \
--key "${name}_enable" \
--value "\"$value\"" \
--delimiter '='
;;
*)
: # handled in gencode-remote
;;
esac

View file

@ -26,5 +26,15 @@ if [ "$value_should" = "$value_is" ]; then
exit 0
fi
os=$(cat "$__global/explorer/os")
case "$os" in
redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
flag='-w'
;;
frebsd)
flag=''
;;
esac
# set the current runtime value
printf 'sysctl -w %s="%s"\n' "$__object_id" "$value_should"
printf 'sysctl %s %s="%s"\n' "$flag" "$__object_id" "$value_should"

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
redhat|centos|ubuntu|debian|devuan|archlinux|coreos|freebsd)
:
;;
*)