This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=e1f0aad3d4c83a210a1ba097135de773c4d960ee

commit e1f0aad3d4c83a210a1ba097135de773c4d960ee
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Fri Sep 8 02:59:52 2023 +0200

    build: Use TAR variable from configure instead of hard-coded tar
    
    We should be using the tar name found during configure checks instead
    of hard-coding it to just tar.
---
 build-aux/subst.am    | 1 +
 src/dpkg-db-backup.sh | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/build-aux/subst.am b/build-aux/subst.am
index 74a40bf0b..5515930d0 100644
--- a/build-aux/subst.am
+++ b/build-aux/subst.am
@@ -9,6 +9,7 @@ do_shell_subst = $(AM_V_GEN) $(SED) \
        -e "s:^BACKUPSDIR=.*$$:BACKUPSDIR='$(backupsdir)':" \
        -e "s:^PKGDATADIR_DEFAULT=.*$$:PKGDATADIR_DEFAULT='$(pkgdatadir)':" \
        -e "s:^version=['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":" \
+       -e "s:^TAR=.*$$:TAR='$(TAR)':" \
        # EOL
 
 SUFFIXES += .sh
diff --git a/src/dpkg-db-backup.sh b/src/dpkg-db-backup.sh
index dbb0d6ca0..619f489ea 100755
--- a/src/dpkg-db-backup.sh
+++ b/src/dpkg-db-backup.sh
@@ -22,6 +22,7 @@ ROTATE=7
 
 PKGDATADIR_DEFAULT=src
 PKGDATADIR="${DPKG_DATADIR:-$PKGDATADIR_DEFAULT}"
+TAR="${TAR:-tar}"
 
 # shellcheck source=src/sh/dpkg-error.sh
 . "$PKGDATADIR/sh/dpkg-error.sh"
@@ -38,8 +39,8 @@ while [ $# -ne 0 ]; do
 done
 
 # Check for required commands availability.
-for cmd in tar savelog; do
-  if ! command -v $cmd >/dev/null; then
+for cmd in "$TAR" savelog; do
+  if ! command -v "$cmd" >/dev/null; then
     error "cannot find required program '$cmd'"
   fi
 done
@@ -78,9 +79,9 @@ if cd $BACKUPSDIR ; then
   # XXX: Ideally we'd use --warning=none instead of discarding stderr, but
   # as of GNU tar 1.27.1, it does not seem to work reliably (see #749307).
   if ! test -e ${dbalt}.tar.0 ||
-     ! tar -df ${dbalt}.tar.0 -C $dbdir $dbalt >/dev/null 2>&1 ;
+     ! $TAR -df ${dbalt}.tar.0 -C $dbdir $dbalt >/dev/null 2>&1 ;
   then
-    tar -cf ${dbalt}.tar -C $dbdir $dbalt >/dev/null 2>&1
+    $TAR -cf ${dbalt}.tar -C $dbdir $dbalt >/dev/null 2>&1
     savelog -c "$ROTATE" ${dbalt}.tar >/dev/null
   fi
 fi

-- 
Dpkg.Org's dpkg

Reply via email to