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=e2f7fc48a0b1d152817c30f7039ae0302fd545b2 commit e2f7fc48a0b1d152817c30f7039ae0302fd545b2 Author: Guillem Jover <[email protected]> AuthorDate: Fri Aug 27 02:59:45 2021 +0200 dpkg-db-backup: Accept an option to override the number of rotation cycles The code was previously in a cron job under /etc, which meant it could be modified by the administrator. Partially restore configurability for something that has a high chance to be in demand of modification. --- scripts/dpkg-db-backup.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/dpkg-db-backup.sh b/scripts/dpkg-db-backup.sh index 5c79362d3..228525bb1 100755 --- a/scripts/dpkg-db-backup.sh +++ b/scripts/dpkg-db-backup.sh @@ -15,9 +15,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. +ROTATE=7 + +while [ $# -ne 0 ]; do + case "$1" in + --rotate=*) + ROTATE="${1#--rotate=}" + ;; + esac + shift +done + dbdir=/var/lib/dpkg -# Backup the 7 last versions of dpkg databases containing user data. +# Backup the N last versions of dpkg databases containing user data. if cd /var/backups ; then # We backup all relevant database files if any has changed, so that # the rotation number always contains an internally consistent set. @@ -39,7 +50,7 @@ if cd /var/backups ; then else touch "dpkg.$db" fi - savelog -c 7 "dpkg.$db" >/dev/null + savelog -c "$ROTATE" "dpkg.$db" >/dev/null done fi @@ -52,6 +63,6 @@ if cd /var/backups ; then ! tar -df ${dbalt}.tar.0 -C $dbdir $dbalt >/dev/null 2>&1 ; then tar -cf ${dbalt}.tar -C $dbdir $dbalt >/dev/null 2>&1 - savelog -c 7 ${dbalt}.tar >/dev/null + savelog -c "$ROTATE" ${dbalt}.tar >/dev/null fi fi -- Dpkg.Org's dpkg

