3 # simple "sign" replacement that does nothing but
4 # write a 2048 byte file with a fixed signature.
5 # sign is used in kiwi builds to sign repositories
10 if ($ARGV[0] =~ /^-([cdr])$/) {
15 if ($ARGV[0] eq '--') {
19 if ($ARGV[0] =~ /^-/) {
20 die("unsupported option $ARGV[0]\n");
24 die("only detached mode possible\n") if !$mode || $mode ne 'd';
25 die("filter mode not supported\n") unless @ARGV;
27 for my $file (@ARGV) {
29 open(F, '<', $file) || die("$file: $!\n");
31 1 while sysread(F, $buf, 16384, length($buf));
32 close(F) || die("$file: $!\n");
33 my $block = "sIGnMe!\n";
34 $block .= sprintf("%08x%08x\n", length($buf), unpack("%32C*", $buf));
35 $block .= "\0" x (2048 - length($block));
36 open(F, '>', "$file.asc") || die("$file.asc: $!\n");
37 (syswrite(F, $block) || 0) == 2048 || die("$file.asc: $!\n");
38 close(F) || die("$file.asc: $!\n");