3 # Intended to be used as a restricted command.
5 # command="/path/to/dgit-mirror-ssh-wrap /srv/repos/ .git --"
6 # or similar. The two substantive arguments are literals.
7 # The example permits writes to directories
8 # /srv/repos/$PACKAGE.git
9 # where $PACKAGE has the syntax of a Debian package name.
13 die 'bad usage' unless @ARGV==3 && $ARGV[2] eq '--';
14 our ($prefix, $suffix) = @ARGV;
16 $prefix =~ s/\W/\\$&/g;
17 $suffix =~ s/\W/\\$&/g;
19 my $package = qr{[0-9a-z][-+.0-9a-z]*};
20 my $d = qr{$prefix$package$suffix};
22 my $command = $ENV{SSH_ORIGINAL_COMMAND}
23 // die "missing SSH_ORIGINAL_COMMAND";
25 #print STDERR ">$d<\n";
29 m{^rsync --server -lHtre\.iLsfxC --timeout=\d+ --delete --safe-links \. $d$}
31 m{^rsync --server -lHtre\.iLsfxCIv --timeout=\d+ --delete --safe-links \. $d$}
33 # To add a new command pattern, add || m{^ ... $} above.
34 # The pattern should contain $d where the per-package destination
37 or die "dgit-mirror-ssh-wrap: unexpected command (rsync upgraded?):