From b3b0604be7a4913186a324a6dbbb1e9a40c09da5 Mon Sep 17 00:00:00 2001 From: Travis Paul Date: Thu, 29 Nov 2018 13:27:06 +0800 Subject: [PATCH] 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. --- bin/_blackbox_common.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/_blackbox_common.sh b/bin/_blackbox_common.sh index 2786781..8125af6 100755 --- a/bin/_blackbox_common.sh +++ b/bin/_blackbox_common.sh @@ -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