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:
parent
cb829ec8d0
commit
005c94556e
3 changed files with 39 additions and 3 deletions
|
@ -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…
Reference in a new issue