/usr/bin/backup-labeltape is in chiark-backup 4.4.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/perl
use POSIX;
$etc= '/etc/chiark-backup';
require "$etc/settings.pl";
require 'backuplib.pl';
while ($ARGV[0] =~ m/^-/) {
$_= shift @ARGV;
last if m/^\-$/;
s/^\-//;
while (length) {
if (s/^f//) {
$force=1;
} else {
die "$0: unknown option -$_\n";
}
}
}
@ARGV==1 or die "$0: need 1 arg, new TAPEID\n";
($newid)= @ARGV;
open LOG, ">/dev/null" or die $!;
readtapeid_raw();
if (!open T,'TAPEID') {
$!==&ENOENT or die $!;
} else {
chomp($oldid= <T>);
close T or die $!;
print "Tape is currently labelled \`$oldid'\n" or die $!;
die "$0: use -f to force relabelling\n" unless $force;
}
open T,'>TAPEID' or die $!;
print T "$newid\n" or die $!;
close T or die $!;
writetapeid($newid,'tapeid set manually');
rewind_raw();
print "Labelled tape \`$newid'\n" or die $!;
exit 0;
|