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=2b460ae42e677ced8ca027c3d6f1a02df73a705d

commit 2b460ae42e677ced8ca027c3d6f1a02df73a705d
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Aug 27 03:06:19 2021 +0200

    build: Parametrize the backups directory with a configure option
    
    Instead of hardcoding the value in various places, use the one specified
    by the configure script.
---
 configure.ac              | 3 +++
 man/Makefile.am           | 1 +
 man/dpkg.pod              | 2 +-
 scripts/Makefile.am       | 1 +
 scripts/dpkg-db-backup.sh | 3 ++-
 5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 94130af7f..cfed39e86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,8 @@ DPKG_WITH_DIR([pkgconfdir], [${sysconfdir}/${PACKAGE_NAME}],
   [dpkg configuration directory [SYSCONFDIR/dpkg]])
 DPKG_WITH_DIR([admindir], [${localstatedir}/lib/${PACKAGE_NAME}],
   [dpkg database directory [LOCALSTATEDIR/lib/dpkg]])
+DPKG_WITH_DIR([backupsdir], [${localstatedir}/backups],
+  [dpkg database backups directory [LOCALSTATEDIR/backups]])
 DPKG_WITH_DIR([logdir], [${localstatedir}/log],
   [system logging directory [LOCALSTATEDIR/log]])
 DPKG_WITH_DIR([zshcompletionsdir], [${datadir}/zsh/vendor-completions],
@@ -269,6 +271,7 @@ Configuration:
     devlibdir . . . . . . . . . . : $devlibdir
     pkgconfdir  . . . . . . . . . : $pkgconfdir
     admindir  . . . . . . . . . . : $admindir
+    backupsdir  . . . . . . . . . : $backupsdir
     logdir  . . . . . . . . . . . : $logdir
     perl interpreter  . . . . . . : $PERL
     perl libdir . . . . . . . . . : $PERL_LIBDIR
diff --git a/man/Makefile.am b/man/Makefile.am
index a0136258c..6f615fe64 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -221,6 +221,7 @@ PODSUBST = $(SED) \
        -e 's:%CONFDIR%:$(sysconfdir):g' \
        -e 's:%LOGDIR%:$(logdir):g' \
        -e 's:%ADMINDIR%:$(admindir):g' \
+       -e 's:%BACKUPSDIR%:$(backupsdir):g' \
        -e 's:%PKGDOCDIR%:$(docdir):g' \
        -e 's:%PKGCONFDIR%:$(pkgconfdir):g' \
        -e 's:%PKGLIBDIR%:$(pkglibexecdir):g' \
diff --git a/man/dpkg.pod b/man/dpkg.pod
index cf927f854..90da24083 100644
--- a/man/dpkg.pod
+++ b/man/dpkg.pod
@@ -1268,7 +1268,7 @@ whether a package is marked for removing or not, whether 
it is
 installed or not, etc. See section B<INFORMATION ABOUT PACKAGES>
 for more info.
 
-The status file is backed up daily in I</var/backups>. It can be
+The status file is backed up daily in I<%BACKUPSDIR%>. It can be
 useful if it's lost or corrupted due to filesystems troubles.
 
 =back
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 97e37bd84..ac9ab5d3b 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -168,6 +168,7 @@ do_perl_subst = $(AM_V_GEN) $(SED) \
 
 do_shell_subst = $(AM_V_GEN) $(SED) \
        -e "s:^ADMINDIR=.*$$:ADMINDIR='$(admindir)':" \
+       -e "s:^BACKUPSDIR=.*$$:BACKUPSDIR='$(backupsdir)':" \
        -e "s:^PKGDATADIR_DEFAULT=.*$$:PKGDATADIR_DEFAULT='$(pkgdatadir)':" \
        -e "s:^version=['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":"
 
diff --git a/scripts/dpkg-db-backup.sh b/scripts/dpkg-db-backup.sh
index f4a0a132a..de42d2114 100755
--- a/scripts/dpkg-db-backup.sh
+++ b/scripts/dpkg-db-backup.sh
@@ -16,6 +16,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 ADMINDIR=/var/lib/dpkg
+BACKUPSDIR=/var/backups
 ROTATE=7
 
 while [ $# -ne 0 ]; do
@@ -30,7 +31,7 @@ done
 dbdir="$ADMINDIR"
 
 # Backup the N last versions of dpkg databases containing user data.
-if cd /var/backups ; then
+if cd $BACKUPSDIR ; then
   # We backup all relevant database files if any has changed, so that
   # the rotation number always contains an internally consistent set.
   dbchanged=no

-- 
Dpkg.Org's dpkg

Reply via email to