Compare commits

...

3 commits

Author SHA1 Message Date
ad6a978229 I hate shell 2018-03-25 21:47:33 +02:00
edf312a26c add explorer: is-freebsd-jail 2018-03-25 21:27:58 +02:00
7d20eb9187 add freebsd support to a few types 2018-03-25 21:27:43 +02:00
8 changed files with 58 additions and 4 deletions

View file

@ -0,0 +1 @@
sysctl -n security.jail.jailed 2>/dev/null | grep "1" || true

View file

@ -40,7 +40,7 @@ case "$os" in
exit 0 exit 0
fi fi
;; ;;
scientific|centos|openbsd) scientific|centos|freebsd|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
@ -62,7 +62,7 @@ case "$os" in
echo "printf '%s\n' '$name_should' > /etc/hostname" echo "printf '%s\n' '$name_should' > /etc/hostname"
echo "hostname -F /etc/hostname" echo "hostname -F /etc/hostname"
;; ;;
openbsd) freebsd|openbsd)
echo "hostname '$name_should'" echo "hostname '$name_should'"
;; ;;
suse) suse)

View file

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

View file

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

View file

@ -77,6 +77,10 @@ case "$state_should" in
echo "update-rc.d \"$name\" defaults >/dev/null" echo "update-rc.d \"$name\" defaults >/dev/null"
;; ;;
freebsd)
: # handled in manifest
;;
*) *)
echo "Unsupported os: $os" >&2 echo "Unsupported os: $os" >&2
exit 1 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 exit 0
fi 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 # 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") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
redhat|centos|ubuntu|debian|devuan|archlinux|coreos) redhat|centos|ubuntu|debian|devuan|archlinux|coreos|freebsd)
: :
;; ;;
*) *)