diff options
Diffstat (limited to 'pkgs/os-specific/bsd/lib/install-wrapper.sh')
-rw-r--r-- | pkgs/os-specific/bsd/lib/install-wrapper.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pkgs/os-specific/bsd/lib/install-wrapper.sh b/pkgs/os-specific/bsd/lib/install-wrapper.sh new file mode 100644 index 0000000000000..91a7a2679f209 --- /dev/null +++ b/pkgs/os-specific/bsd/lib/install-wrapper.sh @@ -0,0 +1,30 @@ +set -eu + +args=() +declare -i path_args=0 + +while (( $# )); do + if (( $# == 1 )); then + if (( path_args > 1)) || [[ "$1" = */ ]]; then + mkdir -p "$1" + else + mkdir -p "$(dirname "$1")" + fi + fi + case $1 in + -C) ;; + -o | -g) shift ;; + -s) ;; + -m | -l) + # handle next arg so not counted as path arg + args+=("$1" "$2") + shift + ;; + -*) args+=("$1") ;; + *) + path_args+=1 + args+=("$1") + ;; + esac + shift +done |