Skip to content

Commit

Permalink
_pkg.sh: streamline test 3
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Apr 9, 2024
1 parent 17ce01d commit 8c643fe
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions _pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ create_pkg() {

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

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

(
cd "${_DST}/.."
case "${_HOST}" in
Expand All @@ -73,21 +75,24 @@ create_pkg() {

find "${_DST}" -depth -type d -exec touch -c -r "$1" '{}' +

find "${_BAS}" | sort > "${_FLS}"

rm -f "${_cdo}/${_pkg}"
case "${arch_ext}" in
.tar.xz) TZ=UTC tar --create \
--format=ustar \
--owner=0 --group=0 --numeric-owner \
--sort=name "${_BAS}" | xz > "${_cdo}/${_pkg}";;
.zip)
find "${_BAS}" | sort | \
TZ=UTC zip --quiet -9 --strip-extra \
--names-stdin - > "${_cdo}/${_pkg}"
;;
--sort=name \
--no-recursion \
--files-from "${_FLS}" | xz > "${_cdo}/${_pkg}";;
.zip) TZ=UTC zip --quiet -9 --strip-extra \
--names-stdin - < "${_FLS}" > "${_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 8c643fe

Please sign in to comment.