Add NetBSD and SunOS support to cp_permissions.

Note that this likely won't work on Solaris without Coreutils as
Solaris lacks stat(1). SmartOS has stat from Coreutils in base
and the chmod(1) from it's OpenSolaris heritage. Using the chmod
from either Coreutils or Solaris will work the same (in this case)
on SmartOS.
This commit is contained in:
Travis Paul
2018-11-29 13:27:06 +08:00
parent 6408b622bf
commit b3b0604be7

View File

@@ -433,10 +433,13 @@ function cp_permissions() {
Darwin )
chmod $( stat -f '%p' "$1" ) "${@:2}"
;;
FreeBSD )
FreeBSD | NetBSD )
chmod $( stat -f '%p' "$1" | sed -e "s/^100//" ) "${@:2}"
;;
Linux | CYGWIN* | MINGW* )
SunOS )
chmod $( stat -c '%a' "$1" ) "${@:2}"
;;
Linux | CYGWIN* | MINGW* | SunOS )
if [[ -e /etc/alpine-release ]]; then
chmod $( stat -c '%a' "$1" ) "${@:2}"
else