Fix to support FreeBSD's stat(1)

Added check for OS type
Added FreeBSD syntax in case of $os=freebsd
remotes/origin/ssh_callback
Jake Guffey 12 years ago
parent cb829ec8d0
commit 005c94556e
  1. 14
      cdist/conf/type/__directory/explorer/group
  2. 14
      cdist/conf/type/__directory/explorer/mode
  3. 14
      cdist/conf/type/__directory/explorer/owner

@ -22,7 +22,19 @@
# #
destination="/$__object_id" destination="/$__object_id"
# Since $__global isn't available, use uname directly, uname and tr are both part of POSIX
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "$os" in
"freebsd")
cmd="stat -f %Sg"
;;
*)
cmd="stat -c %G"
;;
esac
if [ -e "$destination" ]; then if [ -e "$destination" ]; then
stat -c "%G" "$destination" $cmd "$destination"
fi fi

@ -22,7 +22,19 @@
# #
destination="/$__object_id" destination="/$__object_id"
# Since $__global isn't available, use uname directly, uname and tr are both part of POSIX
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "$os" in
"freebsd")
cmd="stat -f %Op"
;;
*)
cmd="stat -c %a"
;;
esac
if [ -e "$destination" ]; then if [ -e "$destination" ]; then
stat -c "%a" "$destination" $cmd "$destination"
fi fi

@ -22,7 +22,19 @@
# #
destination="/$__object_id" destination="/$__object_id"
# Since $__global isn't available, use uname directly, uname and tr are both part of POSIX
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "$os" in
"freebsd")
cmd="stat -f %Su"
;;
*)
cmd="stat -c %U"
;;
esac
if [ -e "$destination" ]; then if [ -e "$destination" ]; then
stat -c "%U" "$destination" $cmd "$destination"
fi fi

Loading…
Cancel
Save