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")
case "$os" in
"freebsd"|"openbsd")
"freebsd"|"netbsd"|"openbsd")
# FIXME: should be something like this based on man page, but can not test
stat -f "type: %ST
owner: %Du %Su

View file

@ -109,6 +109,12 @@ for param in $(ls "$__object/parameter/"); do
# remove trailing ,
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)
# integer key=value parameters
key="$(echo "$param" | tr '-' '_')"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,4 +20,4 @@
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/>.
#
os="$($__explorer/os)"
if [ "$os" = "netbsd" ]; then
echo netbsd
exit
fi
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")"
state_should="$(cat "$__object/parameter/state")"
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"
delparam="-R"
else