Date: Mon, 28 Mar 2011 19:39:53 +0000 (UTC) From: Doug Barton <dougb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r220112 - in stable/8/etc: defaults periodic/daily periodic/security Message-ID: <201103281939.p2SJdrEC004849@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103281939.p2SJdrEC004849>