From owner-svn-src-all@FreeBSD.ORG Mon Mar 28 19:39:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 360121065676; Mon, 28 Mar 2011 19:39:54 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24C628FC20; Mon, 28 Mar 2011 19:39:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2SJdsX2004854; Mon, 28 Mar 2011 19:39:54 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2SJdrEC004849; Mon, 28 Mar 2011 19:39:53 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201103281939.p2SJdrEC004849@svn.freebsd.org> From: Doug Barton Date: Mon, 28 Mar 2011 19:39:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220112 - in stable/8/etc: defaults periodic/daily periodic/security X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2011 19:39:54 -0000 Author: dougb Date: Mon Mar 28 19:39:53 2011 New Revision: 220112 URL: http://svn.freebsd.org/changeset/base/220112 Log: MFC r220020: Add a daily period script to back up /var/db/pkg MFC r220049: Hook the 220.backup-pkgdb script I added to the build unconditionally Hook up 610.ipf6denied based on MK_IPFILTER as 510.ipfdenied is now Added: stable/8/etc/periodic/daily/220.backup-pkgdb - copied unchanged from r220020, head/etc/periodic/daily/220.backup-pkgdb Modified: stable/8/etc/defaults/periodic.conf stable/8/etc/periodic/daily/Makefile stable/8/etc/periodic/security/Makefile Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/defaults/periodic.conf ============================================================================== --- stable/8/etc/defaults/periodic.conf Mon Mar 28 19:32:16 2011 (r220111) +++ stable/8/etc/defaults/periodic.conf Mon Mar 28 19:39:53 2011 (r220112) @@ -74,6 +74,10 @@ daily_backup_passwd_enable="YES" # Bac # 210.backup-aliases daily_backup_aliases_enable="YES" # Backup mail aliases +# 220.backup-pkgdb +daily_backup_pkgdb_enable="YES" # Backup /var/db/pkg +daily_backup_pkgdb_dir="/var/backups" + # 300.calendar daily_calendar_enable="NO" # Run calendar -a Copied: stable/8/etc/periodic/daily/220.backup-pkgdb (from r220020, head/etc/periodic/daily/220.backup-pkgdb) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/etc/periodic/daily/220.backup-pkgdb Mon Mar 28 19:39:53 2011 (r220112, copy of r220020, head/etc/periodic/daily/220.backup-pkgdb) @@ -0,0 +1,50 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +rc=0 + +case "$daily_backup_pkgdb_enable" in + [Yy][Ee][Ss]) + bak="${daily_backup_pkgdb_dir:-/var/backups}" + bak_file="${bak}/pkgdb.bak.tbz" + + pkg_dbdir=`make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/dev/null` + + if [ ! -d "$bak" ] + then + install -d -o root -g wheel -m 750 $bak || { + echo '$daily_backup_pkgdb_enable is enabled but' \ + "$daily_backup_pkgdb_dbdir doesn't exist" ; + exit 2 ; } + fi + + echo '' + echo 'Backing up package db directory:' + + new_bak_file=`mktemp ${bak_file}-XXXXX` + + if tar -cjf "${new_bak_file}" "$pkg_dbdir"; then + chmod 644 "${new_bak_file}" + + if [ -e "${bak_file}.2" -a -e "${bak_file}" ]; then + unlink "${bak_file}.2" + mv "${bak_file}" "${bak_file}.2" + fi + [ -e "${bak_file}" ] && mv "${bak_file}" "${bak_file}.2" + mv "${new_bak_file}" "${bak_file}" + else + rc=3 + fi ;; +esac + +exit $rc Modified: stable/8/etc/periodic/daily/Makefile ============================================================================== --- stable/8/etc/periodic/daily/Makefile Mon Mar 28 19:32:16 2011 (r220111) +++ stable/8/etc/periodic/daily/Makefile Mon Mar 28 19:39:53 2011 (r220112) @@ -6,6 +6,7 @@ FILES= 100.clean-disks \ 110.clean-tmps \ 120.clean-preserve \ 200.backup-passwd \ + 220.backup-pkgdb \ 330.news \ 400.status-disks \ 405.status-ata-raid \ Modified: stable/8/etc/periodic/security/Makefile ============================================================================== --- stable/8/etc/periodic/security/Makefile Mon Mar 28 19:32:16 2011 (r220111) +++ stable/8/etc/periodic/security/Makefile Mon Mar 28 19:39:53 2011 (r220112) @@ -17,6 +17,7 @@ FILES= 100.chksetuid \ .if ${MK_IPFILTER} != "no" FILES+= 510.ipfdenied +FILES+= 610.ipf6denied .endif .if ${MK_IPFW} != "no"