]> git.cameronkatri.com Git - apple_cmds.git/commitdiff
Improve create_tarballs.sh
authorCameron Katri <me@cameronkatri.com>
Sat, 15 May 2021 02:11:21 +0000 (22:11 -0400)
committerCameron Katri <me@cameronkatri.com>
Sat, 15 May 2021 02:11:21 +0000 (22:11 -0400)
create_tarballs.sh

index 25df18780e65b3604802682ccbed5e688cfe08aa..cec2e82cf5e1e609c93baa3da65671d5f1c81585 100755 (executable)
@@ -1,4 +1,13 @@
 #!/bin/sh
+if command -v bsdtar &>/dev/null; then
+       TAR="bsdtar"
+elif ! tar --version | grep "GNU" &>/dev/null; then
+       TAR="tar"
+else
+       echo "Install BSD tar"
+       exit 1
+fi
+
 num=0
 for i in adv_cmds basic_cmds bootstrap_cmds \
                developer_cmds diskdev_cmds doc_cmds \
@@ -6,11 +15,12 @@ for i in adv_cmds basic_cmds bootstrap_cmds \
                patch_cmds remote_cmds shell_cmds \
                system_cmds text_cmds; do
        EXTRA_PATHS=""
+       TARFLAGS="caf"
        case "$i" in
-               network_cmds) EXTRA_PATHS="lib/libpcap";;
-               remote_cmds) EXTRA_PATHS="lib/libtelnet";;
+               network_cmds) TARFLAGS="-s '|^|network_cmds/|' -caf" EXTRA_PATHS="lib/libpcap";;
+               remote_cmds) TARFLAGS="-s '|^|remote_cmds/|' -caf" EXTRA_PATHS="lib/libtelnet";;
        esac
        num=$((num+1))
        printf "(%i) %s\n" "$num" "$i"
-       tar caf $i.tar.zst $i ${EXTRA_PATHS}
-done
+       ${TAR} ${TARFLAGS} $i.tar.zst $i ${EXTRA_PATHS}
+done
\ No newline at end of file