+
+ if (length $dopt{'snap'}) {
+ length $dev or die "$pcstr:$atf no device but needed for snap";
+ }
+}
+
+sub execute ($) {
+ pboth(" $_[0]\n");
+ system $_[0]; $? and die "$_[0] $?";
+}
+
+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'}";
+ $snapargs= "/var/lib/chiark-backup";
+
+ $snapsnap= "$snapbase snap $snapargs $dev $atf";
+ $snapdrop= "$snapbase drop $snapargs";
+
+ open SD, ">snap-drop.new" or die $!;
+ print SD $snapdrop,"\n" or die $!;
+ close SD or die $!;
+ rename "snap-drop.new","snap-drop" or die $!;
+
+ execute($snapsnap);
+
+ $dev_nosnap= $dev;
+ $atf_nosnap= $atf;
+ $dev= "/var/lib/chiark-backup/snap-device";
+ $atf= "/var/lib/chiark-backup/snap-mount";
+ }
+}
+
+sub finfsys () {
+ if (length $dopt{'snap'}) {
+ system('snap-drop'); $? and die $?;
+ }