Fix to support FreeBSD's stat(1)

Added check for OS type
Added FreeBSD syntax in case of $os=freebsd
This commit is contained in:
Jake Guffey 2013-02-19 15:23:52 -05:00
parent cb829ec8d0
commit 005c94556e
3 changed files with 39 additions and 3 deletions

View file

@ -22,7 +22,19 @@
#
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
stat -c "%G" "$destination"
$cmd "$destination"
fi

View file

@ -22,7 +22,19 @@
#
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
stat -c "%a" "$destination"
$cmd "$destination"
fi

View file

@ -22,7 +22,19 @@
#
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
stat -c "%U" "$destination"
$cmd "$destination"
fi