Skip to content

Commit

Permalink
_pkg.sh: streamline test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Apr 9, 2024
1 parent 2a3eee0 commit 17ce01d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions _pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ _cdo="$(pwd)"

if [ "${_NAM}" != "${_UNIPKG}" ]; then

find "${_DST}" -depth -type d -exec touch -c -r "$1" '{}' +
chmod -R a+rw-s,go-w "${_DST}"
# NOTE: Not effective on MSYS2:
find "${_DST}" -name '*.a' -exec chmod a-x '{}' +
Expand Down Expand Up @@ -66,30 +65,29 @@ create_pkg() {

_pkg="${_OUT}${_suf}${arch_ext}"

_FLS="$(dirname "$0")/_files"

(
cd "${_DST}/.."
case "${_HOST}" in
win) find "${_BAS}" -exec attrib +A -R '{}' \;
esac

find "${_BAS}" -type f -o -type l | sort > "${_FLS}"
find "${_DST}" -depth -type d -exec touch -c -r "$1" '{}' +

rm -f "${_cdo}/${_pkg}"
case "${arch_ext}" in
.tar.xz) TZ=UTC tar --create \
--format=ustar \
--owner=0 --group=0 --numeric-owner \
--files-from "${_FLS}" | xz > "${_cdo}/${_pkg}";;
.zip) TZ=UTC zip --quiet -9 --strip-extra \
--names-stdin - < "${_FLS}" > "${_cdo}/${_pkg}";;
--sort=name "${_BAS}" | xz > "${_cdo}/${_pkg}";;
.zip)
find "${_BAS}" | sort | \
TZ=UTC zip --quiet -9 --strip-extra \
--names-stdin - > "${_cdo}/${_pkg}"
;;
esac
touch -c -r "$1" "${_cdo}/${_pkg}"
)

rm -f "${_FLS}"

# <filename>: <size> bytes <YYYY-MM-DD> <HH:MM>
case "${_HOST}" in
bsd|mac) TZ=UTC stat -f '%N: %z bytes %Sm' -t '%Y-%m-%d %H:%M' "${_pkg}";;
Expand Down

0 comments on commit 17ce01d

Please sign in to comment.