]> git.cameronkatri.com Git - apple_cmds.git/commitdiff
create_tarballs.sh: Make it work correctly
authorCameron Katri <me@cameronkatri.com>
Sat, 15 May 2021 02:47:55 +0000 (22:47 -0400)
committerCameron Katri <me@cameronkatri.com>
Sat, 15 May 2021 02:47:55 +0000 (22:47 -0400)
create_tarballs.sh

index cec2e82cf5e1e609c93baa3da65671d5f1c81585..89e15883908b9b342b6ce295e25cf1e6dc10a025 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
-if command -v bsdtar &>/dev/null; then
+if command -v bsdtar >/dev/null 2>&1; then
        TAR="bsdtar"
-elif ! tar --version | grep "GNU" &>/dev/null; then
+elif ! tar --version | grep "GNU" >/dev/null 2>&1; then
        TAR="tar"
 else
        echo "Install BSD tar"
@@ -15,12 +15,18 @@ for i in adv_cmds basic_cmds bootstrap_cmds \
                patch_cmds remote_cmds shell_cmds \
                system_cmds text_cmds; do
        EXTRA_PATHS=""
-       TARFLAGS="caf"
+       REGEX=""
        case "$i" in
-               network_cmds) TARFLAGS="-s '|^|network_cmds/|' -caf" EXTRA_PATHS="lib/libpcap";;
-               remote_cmds) TARFLAGS="-s '|^|remote_cmds/|' -caf" EXTRA_PATHS="lib/libtelnet";;
+               network_cmds) REGEX="|^|network_cmds/|" EXTRA_PATHS="lib/libpcap";;
+               remote_cmds) REGEX="|^|remote_cmds/|" EXTRA_PATHS="lib/libtelnet";;
        esac
        num=$((num+1))
        printf "(%i) %s\n" "$num" "$i"
-       ${TAR} ${TARFLAGS} $i.tar.zst $i ${EXTRA_PATHS}
-done
\ No newline at end of file
+       cp setup.sh $i/setup.sh
+       if [ "${REGEX}" == "" ]; then
+               ${TAR} -caf $i.tar.zst $i ${EXTRA_PATHS}
+       else
+               ${TAR} -s ${REGEX} -caf $i.tar.zst $i ${EXTRA_PATHS}
+       fi
+       rm $i/setup.sh
+done