Merge remote-tracking branch 'telmich/master'

This commit is contained in:
Steven Armstrong 2015-10-27 15:55:25 +01:00
commit 7997551b48
11 changed files with 33 additions and 10 deletions

View file

@ -25,7 +25,7 @@ destination="/$__object_id"
os=$("$__explorer/os") os=$("$__explorer/os")
case "$os" in case "$os" in
"freebsd"|"openbsd") "freebsd"|"netbsd"|"openbsd")
# FIXME: should be something like this based on man page, but can not test # FIXME: should be something like this based on man page, but can not test
stat -f "type: %ST stat -f "type: %ST
owner: %Du %Su owner: %Du %Su

View file

@ -109,6 +109,12 @@ for param in $(ls "$__object/parameter/"); do
# remove trailing , # remove trailing ,
printf ' ,"retry_join": [%s]\n' "${retry_join%*,}" printf ' ,"retry_join": [%s]\n' "${retry_join%*,}"
;; ;;
retry-join-wan)
# join multiple parameters into json array over wan
retry_join_wan="$(awk '{printf "\""$1"\","}' "$__object/parameter/retry-join-wan")"
# remove trailing ,
printf ' ,"retry_join_wan": [%s]\n' "${retry_join_wan%*,}"
;;
bootstrap-expect) bootstrap-expect)
# integer key=value parameters # integer key=value parameters
key="$(echo "$param" | tr '-' '_')" key="$(echo "$param" | tr '-' '_')"

View file

@ -17,3 +17,4 @@ key-file-source
node-name node-name
user user
state state
advertise-wan

View file

@ -1 +1,2 @@
retry-join retry-join
retry-join-wan

View file

@ -25,7 +25,7 @@ destination="/$__object_id"
os=$("$__explorer/os") os=$("$__explorer/os")
case "$os" in case "$os" in
"freebsd"|"openbsd") "freebsd"|"netbsd"|"openbsd")
# FIXME: should be something like this based on man page, but can not test # FIXME: should be something like this based on man page, but can not test
stat -f "type: %ST stat -f "type: %ST
owner: %Du %Su owner: %Du %Su

View file

@ -25,7 +25,7 @@ destination="/$__object_id"
os=$("$__explorer/os") os=$("$__explorer/os")
case "$os" in case "$os" in
"freebsd"|"openbsd") "freebsd"|"netbsd"|"openbsd")
# FIXME: should be something like this based on man page, but can not test # FIXME: should be something like this based on man page, but can not test
stat -f "type: %ST stat -f "type: %ST
owner: %Du %Su owner: %Du %Su

View file

@ -24,9 +24,11 @@
name=$__object_id name=$__object_id
os="$($__explorer/os)" os="$($__explorer/os)"
if [ "$os" = "freebsd" ]; then case "$os" in
echo "FreeBSD does not have getent gshadow" "freebsd"|"netbsd")
echo "$os does not have getent gshadow"
exit 0 exit 0
fi ;;
esac
getent gshadow "$name" || true getent gshadow "$name" || true

View file

@ -34,7 +34,7 @@ case "$os" in
__package timezone __package timezone
export require="__package/timezone" export require="__package/timezone"
;; ;;
freebsd) freebsd|netbsd)
# whitelist # whitelist
: :
;; ;;

View file

@ -20,4 +20,4 @@
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
(id --groups --name "$user" | tr ' ' '\n' | sort) 2>/dev/null || true (id -G -n "$user" | tr ' ' '\n' | sort) 2>/dev/null || true

View file

@ -18,4 +18,11 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
os="$($__explorer/os)"
if [ "$os" = "netbsd" ]; then
echo netbsd
exit
fi
usermod --help | grep -q -- '-A group' && echo true || echo false usermod --help | grep -q -- '-A group' && echo true || echo false

View file

@ -21,8 +21,14 @@
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
state_should="$(cat "$__object/parameter/state")" state_should="$(cat "$__object/parameter/state")"
oldusermod="$(cat "$__object/explorer/oldusermod")" oldusermod="$(cat "$__object/explorer/oldusermod")"
os=$(cat "$__global/explorer/os")
if [ "$oldusermod" = "true" ]; then if [ "$os" = "netbsd" ]; then
# NetBSD does not have a command to remove a user from a group
oldusermod="true"
addparam="-G"
delparam=";;#"
elif [ "$oldusermod" = "true" ]; then
addparam="-A" addparam="-A"
delparam="-R" delparam="-R"
else else