# other UN*X-compatible machines, as used on chiark.greenend.org.uk.
#
# chiark backup is:
-# Copyright (C) 1997-1998,2000-2001 Ian Jackson <ian@chiark.greenend.org.uk>
+# Copyright (C) 1997-1998,2000-2001,2007
+# Ian Jackson <ian@chiark.greenend.org.uk>
# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2, or (at your option) any later version.
+# Foundation; either version 3, or (at your option) any later version.
#
# This is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# details.
#
# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# with this program; if not, consult the Free Software Foundation's
+# website at www.fsf.org, or the GNU Project website at www.gnu.org.
require IO::File;
$dopts= $3;
$prefix= '<local>';
$pcstr= '';
- stat $atf or die "stat $atf: $!";
- -d _ or die "not a dir: $atf";
$rstr= '';
} elsif ($tf =~ m#^(/\S*)\s+(\w+)([,=0-9a-z]*)\s+(\w+)$#) {
# Line of form '[/device:]/file/system dumptype[,options] prefix'
$dev = $atf =~ s,^(.*)\:,, ? $1 : '';
+ if (!length $pcstr) {
+ stat $atf or die "stat $atf: $!";
+ -d _ or die "not a dir: $atf";
+ }
+
undef %dopt;
foreach $dopt (split /\,/,$dopts) {
- if (grep { $dopt eq $_ } qw(gz)) {
+ if (grep { $dopt eq $_ } qw(gz noinc)) {
$dopt{$dopt}= 'y';
- if (grep { $dopt eq $_ } qw(snap)) {
+ } elsif (grep { $dopt eq $_ } qw(snap)) {
$dopt{$dopt}= $dopt;
} elsif ($dopt =~ m/\=/ && grep { $` eq $_ } qw(gz snap)) {
$dopt{$`}= $';
$$gzo= '';
}
}
+
+ if (length $dopt{'snap'}) {
+ length $dev or die "$pcstr:$atf no device but needed for snap";
+ }
}
sub execute ($) {
}
sub prepfsys () {
+ $dev_print= $dev;
+ $atf_print= $atf;
+
if (length $dopt{'snap'}) {
+
system('snap-drop'); $? and die $?;
$snapscripts= '/etc/chiark-backup/snap';
- $snapbase= "$rstr $snapscripts/$dopt{'snap'} /var/lib/chiark-backup";
+ $snapbase= "$rstr $snapscripts/$dopt{'snap'}";
+ $snapargs= "/var/lib/chiark-backup";
- $snapsnap= "$snapbase snap $dev $atf";
- $snapdrop= "$snapbase drop";
+ $snapsnap= "$snapbase snap $snapargs $dev $atf";
+ $snapdrop= "$snapbase drop $snapargs";
open SD, ">snap-drop.new" or die $!;
print SD $snapdrop,"\n" or die $!;