From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 22 14:19:50 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F1C9106564A; Thu, 22 Apr 2010 14:19:50 +0000 (UTC) (envelope-from trond@fagskolen.gjovik.no) Received: from smtp.fagskolen.gjovik.no (smtp.fagskolen.gjovik.no [IPv6:2001:700:1100:1:200:ff:fe00:b]) by mx1.freebsd.org (Postfix) with ESMTP id B8C9F8FC1E; Thu, 22 Apr 2010 14:19:49 +0000 (UTC) Received: from mail.fig.ol.no (localhost [127.0.0.1]) by mail.fig.ol.no (8.14.4/8.14.4) with ESMTP id o3MEJUXA050990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 Apr 2010 16:19:30 +0200 (CEST) (envelope-from trond@fagskolen.gjovik.no) Received: from localhost (trond@localhost) by mail.fig.ol.no (8.14.4/8.14.4/Submit) with ESMTP id o3MEJUGI050987; Thu, 22 Apr 2010 16:19:30 +0200 (CEST) (envelope-from trond@fagskolen.gjovik.no) X-Authentication-Warning: mail.fig.ol.no: trond owned process doing -bs Date: Thu, 22 Apr 2010 16:19:25 +0200 (CEST) From: =?ISO-8859-1?Q?Trond_Endrest=F8l?= Sender: Trond.Endrestol@fagskolen.gjovik.no To: Eitan Adler In-Reply-To: Message-ID: References: <4BCE5ECC.6070202@gmail.com> <4BCFE209.20501@FreeBSD.org> <20100422111758.GA39338@ei.bzerk.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) Organization: =?ISO-8859-1?Q?Fagskolen_i_Gj=F8vik?= OpenPGP: url=http://fagskolen.gjovik.no/~trond/trond.key MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="2055831798-1592387152-1271945970=:29574" X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_05 autolearn=ham version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on mail.fig.ol.no Cc: freebsd-hackers@freebsd.org, Ruben de Groot , Doug Barton , "Aryeh M. Friedman" Subject: Re: regenerating /var/db/pkg X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2010 14:19:50 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2055831798-1592387152-1271945970=:29574 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 22 Apr 2010 15:21+0300, Eitan Adler wrote: > > Just asking opinions, if people want this, I'll make a patch and > > file a PR. > > Is this script correct? > > #!/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="/var/db/pkg"; > bk_loc="/$bak/pkgdb.bak.tar" It's really no big deal, but from a pragmatic view I'd write: bk_loc="$bak/pkgdb.bak.tar" Otherwise $bk_loc will contain: //var/backups/pkgdb.bak.tar > > 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 mail aliases:" It's really the package directory, no? > if [ ! -f $bk_loc ] > then > echo "no $bk_loc" > tar -cjf $bk_loc $db_loc || rc=3 How do you plan to capture changes made to /var/db/pkg? If we're supposed to manually delete /var/backups/pkgdb.bak.tar from time to time, then the presented code is probably ok. > fi > fi;; > > *) rc=0;; > esac > > exit $rc Just my $0.02, Trond. - -- - ---------------------------------------------------------------------- Trond Endrestøl | Trond.Endrestol@fagskolen.gjovik.no ACM, NAS, NUUG, SAGE, USENIX | FreeBSD 8.0-STABLE & Alpine 2.00 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkvQWvIACgkQbYWZalUoEluyegCfYq/FMpdT9/wRGQyGF8+2WgKQ aGIAn2S2br054BRHc38IpB4uWYVYH94I =GA9V -----END PGP SIGNATURE----- --2055831798-1592387152-1271945970=:29574--