From 3132b6c3eebf3f16d43c2189fc9be5e52a6b2018 Mon Sep 17 00:00:00 2001 From: ianmdlvl Date: Sun, 21 Sep 2003 22:32:33 +0000 Subject: [PATCH] @@ -1,8 +1,17 @@ +chiark-utils (4.0.99.0.3) unstable; urgency=low + + * use -m600 when creating named pipe + + -- Ian Jackson Sun, 21 Sep 2003 23:31:39 +0100 + chiark-utils (4.0.99.0.2) unstable; urgency=low * ship snap-drop + * don't mind devices on local filesystems (was failed stat bug) + * snap bugfixes + * use dump label - -- + -- Ian Jackson Sun, 21 Sep 2003 23:06:00 +0100 chiark-utils (4.0.99.0.1) unstable; urgency=low --- backup/Makefile | 10 ++++++---- backup/backuplib.pl | 24 ++++++++++++++++++------ backup/full | 9 +++++---- backup/increm | 10 +++++----- backup/iwjbackup.txt | 1 + backup/lvm | 1 + backup/snap-drop | 2 +- debian/changelog | 11 ++++++++++- debian/chiark-backup/conffiles | 3 +++ debian/rules | 3 +++ 10 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 debian/chiark-backup/conffiles diff --git a/backup/Makefile b/backup/Makefile index a8c767e..6dfb904 100644 --- a/backup/Makefile +++ b/backup/Makefile @@ -25,9 +25,8 @@ us= chiark-backup include ../settings.make -BINSCRIPTS= checkallused loaded driver takedown whatsthis labeltape \ - snap-drop -SHARESCRIPTS= bringup full increm +BINSCRIPTS= checkallused loaded driver takedown whatsthis labeltape +SHARESCRIPTS= bringup full increm snap-drop SHAREFILES= backuplib.pl SNAPKINDS= lvm remount @@ -42,7 +41,10 @@ install: all $(INSTALL_SCRIPT) $$s $(bindir)/backup-$$s; done $(INSTALL_SHARE) $(SHAREFILES) $(sharedir) $(INSTALL_SCRIPT) $(SHARESCRIPTS) $(sharedir) - $(INSTALL_SCRIPT) $(SNAPKINDS) $(confdir)/snap + set -e; for s in $(SNAPKINDS); do \ + d=$(confdir)/snap/$$s; \ + test ! -f $$d || d=$$d.dist; \ + $(INSTALL_SCRIPT) $$s $$d; done install-docs: $(INSTALL_DIRECTORY) $(txtdocdir) diff --git a/backup/backuplib.pl b/backup/backuplib.pl index ddeb5bb..b537f2f 100644 --- a/backup/backuplib.pl +++ b/backup/backuplib.pl @@ -173,8 +173,6 @@ sub parsefsys () { $dopts= $3; $prefix= ''; $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' @@ -197,11 +195,16 @@ sub parsefsys () { $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)) { $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{$`}= $'; @@ -222,6 +225,10 @@ sub parsefsys () { $$gzo= ''; } } + + if (length $dopt{'snap'}) { + length $dev or die "$pcstr:$atf no device but needed for snap"; + } } sub execute ($) { @@ -230,14 +237,19 @@ 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 $!; diff --git a/backup/full b/backup/full index d4e5fca..fffbb1a 100755 --- a/backup/full +++ b/backup/full @@ -161,7 +161,7 @@ unlink 'this-md5sums'; print "Doing $doing ...\n" or die $!; unlink 'p'; -system 'mknod p p'; $? and die $?; +system 'mknod -m600 p p'; $? and die $?; setstatus "FAILED during dump"; @@ -204,12 +204,13 @@ for $tf (@fsys) { $ddcmd .= " conv=sync"; } - nexttapefile("full $prefix:$atf"); + nexttapefile("full $prefix:$atf_print"); # We can back up via dump or cpio or zafio $dumpin= '&FINDOW',$rstr."find $atf -xdev -noleaf -print0"; $dumpcmd= "cpio -Hustar -o0C$softblocksizebytes"; @@ -226,7 +227,7 @@ for $tf (@fsys) { execute("$rstr touch $fsidfile+new"); $dumpcmd= "tar Ccfl $atf - ."; } else { - die "unknown method $tm for $prefix:$atf\n"; + die "unknown method $tm for $prefix:$atf_print\n"; } # This is a funky way of doing a pipeline which pays attention # to the exit status of all the commands in the pipeline. diff --git a/backup/increm b/backup/increm index b50f50e..945bb0e 100755 --- a/backup/increm +++ b/backup/increm @@ -104,15 +104,16 @@ for $tf (@fsys) { } if ($tm eq 'dump') { - $dumpcmd= "dump 1bfu $softblocksizekb - $atf"; + $dumplabel= $pcstr.$atf_print.'$'; + $dumpcmd= "dump 1Lbfu $dumplabel $softblocksizekb - $atf"; } elsif ($tm eq 'gtar') { $dumpcmd= "tar NCcfl $fsidfile $atf - ."; } else { - pboth("Not dumping $atf ($prefix) - not supported.\n"); + pboth("Not dumping $atf_print ($prefix) - not supported.\n"); next; } - nexttapefile("inc $prefix:$atf"); + nexttapefile("inc $prefix:$atf_print"); # Same trick as full uses to do a pipeline whilst keeping track # of all exit statuses: @@ -139,8 +140,7 @@ print IAN "$advance\n" or die $!; close IAN or die $!; rename 'increm-advance.new','increm-advance' or die $!; -print LOG "Next FULL dump tape is $next\n" or die $!; -print "Next FULL dump tape is $next\n" or die $!; +pboth("Next FULL dump tape is $next\n"); setstatus "INCREMENTAL successful: $tapedesc, next full is $next"; exit 0; diff --git a/backup/iwjbackup.txt b/backup/iwjbackup.txt index 775e65a..5362fd1 100644 --- a/backup/iwjbackup.txt +++ b/backup/iwjbackup.txt @@ -94,6 +94,7 @@ Options supported: Indicates that the filesystem should be frozen before the backup by using /etc/chiark-backup/snap/. See the head comment in /etc/chiark-backup/snap/lvm for details of how this works. + When snap= is used, the block device must be specified. expected-diffs is a config file to indicate which filesystems should *not* be backed up. The scripts do a config diff --git a/backup/lvm b/backup/lvm index 3e9cc2b..592513a 100755 --- a/backup/lvm +++ b/backup/lvm @@ -35,6 +35,7 @@ esac #---------- clean up anything +snmnt="$vardir/snap-mount" umount -v "$snmnt" || true test ! -d "$snmnt" || rmdir -- "$snmnt" diff --git a/backup/snap-drop b/backup/snap-drop index 39deaf1..e3acf7f 100755 --- a/backup/snap-drop +++ b/backup/snap-drop @@ -2,6 +2,6 @@ set -e vd=/var/lib/chiark-backup cd "$vd" -test -f snap-drop +test -f snap-drop || exit 0 sh -x snap-drop || true rm snap-drop diff --git a/debian/changelog b/debian/changelog index cb5c1ce..1a7c5ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,17 @@ +chiark-utils (4.0.99.0.3) unstable; urgency=low + + * use -m600 when creating named pipe + + -- Ian Jackson Sun, 21 Sep 2003 23:31:39 +0100 + chiark-utils (4.0.99.0.2) unstable; urgency=low * ship snap-drop + * don't mind devices on local filesystems (was failed stat bug) + * snap bugfixes + * use dump label - -- + -- Ian Jackson Sun, 21 Sep 2003 23:06:00 +0100 chiark-utils (4.0.99.0.1) unstable; urgency=low diff --git a/debian/chiark-backup/conffiles b/debian/chiark-backup/conffiles new file mode 100644 index 0000000..83e926d --- /dev/null +++ b/debian/chiark-backup/conffiles @@ -0,0 +1,3 @@ +/etc/chiark-backup/settings.sh +/etc/chiark-backup/snap/lvm +/etc/chiark-backup/snap/remount diff --git a/debian/rules b/debian/rules index 1733dcd..30a80f0 100755 --- a/debian/rules +++ b/debian/rules @@ -66,6 +66,9 @@ binary-prep: for m in *.1; do \ mv "$$m" backup-"$$m"; \ done + cp \ + $t/chiark-backup/usr/share/doc/chiark-backup/examples/chiark/settings.sh \ + $t/chiark-backup/etc/chiark-backup/settings.sh # install -d $t/chiark-really/usr/sbin install -d $t/chiark-really/usr/share/man/man8 -- 2.30.2