diff --git a/cdist/conf/type/__directory/explorer/group b/cdist/conf/type/__directory/explorer/group index b14794e3..e5be37da 100644 --- a/cdist/conf/type/__directory/explorer/group +++ b/cdist/conf/type/__directory/explorer/group @@ -22,7 +22,18 @@ # destination="/$__object_id" +os=$("$__explorer/os") + +case "$os" in + "freebsd") + cmd="stat -f %Sg" + ;; + *) + cmd="stat -c %G" + ;; +esac if [ -e "$destination" ]; then - stat -c "%G" "$destination" + $cmd "$destination" fi + diff --git a/cdist/conf/type/__directory/explorer/mode b/cdist/conf/type/__directory/explorer/mode index 3ffa497e..f75b282b 100644 --- a/cdist/conf/type/__directory/explorer/mode +++ b/cdist/conf/type/__directory/explorer/mode @@ -22,7 +22,18 @@ # destination="/$__object_id" +os=$("$__explorer/os") + +case "$os" in + "freebsd") + cmd="stat -f %Op" + ;; + *) + cmd="stat -c %a" + ;; +esac if [ -e "$destination" ]; then - stat -c "%a" "$destination" + $cmd "$destination" fi + diff --git a/cdist/conf/type/__directory/explorer/owner b/cdist/conf/type/__directory/explorer/owner index a691ac1b..cebd199b 100644 --- a/cdist/conf/type/__directory/explorer/owner +++ b/cdist/conf/type/__directory/explorer/owner @@ -22,7 +22,18 @@ # destination="/$__object_id" +os=$("$__explorer/os") + +case "$os" in + "freebsd") + cmd="stat -f %Su" + ;; + *) + cmd="stat -c %U" + ;; +esac if [ -e "$destination" ]; then - stat -c "%U" "$destination" + $cmd "$destination" fi + diff --git a/cdist/conf/type/__jail/gencode-remote b/cdist/conf/type/__jail/gencode-remote index 7491754c..b044e4b0 100755 --- a/cdist/conf/type/__jail/gencode-remote +++ b/cdist/conf/type/__jail/gencode-remote @@ -92,6 +92,20 @@ fi present="$(cat "$__object/explorer/present")" status="$(cat "$__object/explorer/status")" +# Handle ip="iface|addr, iface|addr" format +if [ $(expr "${ip}" : ".*|.*") -gt "0" ]; then + # If we have multiple IPs defined, $interface doesn't make sense because ip="iface|addr, iface|addr" implies it + interface="" + SAVE_IFS="$IFS" + IFS=", " + for cur_ip in ${ip}; do + # Just get the last IP address for SSH to listen on + mgmt_ip=$(echo "${ip}" | sed -E -e 's/^.*\|(.*)\/[0-9]+$/\1/') + done + IFS="$SAVE_IFS" +else + mgmt_ip=$(echo "${ip}" | cut '-d ' -f1) +fi stopJail() { # Check $status before issuing command @@ -160,10 +174,10 @@ EOF createJail() { # Create the jail directory cat <>/etc/rc.conf <>"${jaildir}/rw/${name}/etc/rc.conf" EOF # Configure SSHd's listening address cat <