Date: Thu, 22 Apr 2010 20:44:08 GMT From: Eitan Adler <EitanAdlerList@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/145957: add periodic script to back up /var/db/pkg Message-ID: <201004222044.o3MKi8rq016096@www.freebsd.org> Resent-Message-ID: <201004222050.o3MKo1gG008709@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 145957 >Category: ports >Synopsis: add periodic script to back up /var/db/pkg >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 22 20:50:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Eitan Adler >Release: >Organization: >Environment: >Description: Discussion took place at http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg70999.html Index: periodic/daily/220.backup.pkgdb =================================================================== --- periodic/daily/220.backup.pkgdb (revision 0) +++ periodic/daily/220.backup.pkgdb (revision 0) @@ -0,0 +1,38 @@ +#!/bin/sh +# +# $FreeBSD: src/etc/periodic/daily/210.backup-aliases,v 1.6.36.1.2.1 2009/10/25 01:10:29 kensmith Exp $ +# + +# 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 + +bak=/var/backups +db_loc=$(/usr/bin/make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/dev/null) +bk_loc="$bak/pkgdb.bak.tar.bz2" + +case "$daily_backup_pkgdb_enable" in + [Yy][Ee][Ss]) + if [ ! -d $db_loc ] + then + echo '$daily_backup_pkgdb_enable is enabled but' \ + "$db_loc doesn't exist" + rc=2 + else + rc=0 + + echo "" + echo "Backing up package db directory:" + + [ -e $bk_loc ] && unlink $bk_loc + tar -cjf $bk_loc $db_loc || rc=3 + fi;; + + *) rc=0;; +esac + +exit $rc Index: defaults/periodic.conf =================================================================== --- defaults/periodic.conf (revision 207071) +++ defaults/periodic.conf (working copy) @@ -74,6 +74,9 @@ # 210.backup-aliases daily_backup_aliases_enable="YES" # Backup mail aliases +# 220.backup.pkgdb # Backup package directory +daily_backup_pkgdb_enable=YES" + # 300.calendar daily_calendar_enable="NO" # Run calendar -a >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004222044.o3MKi8rq016096>