projects
/
bak-git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6827651
)
bak link host:/source/path.txt
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 22 Jun 2012 14:08:41 +0000
(16:08 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 22 Jun 2012 14:08:41 +0000
(16:08 +0200)
bak-git-server.pl
patch
|
blob
|
history
diff --git
a/bak-git-server.pl
b/bak-git-server.pl
index
4acf227
..
58d4dfe
100755
(executable)
--- a/
bak-git-server.pl
+++ b/
bak-git-server.pl
@@
-165,6
+165,13
@@
sub pull_changes {
rsync split / /, "-avv --files-from /tmp/$hostname.list root\@$hostname:/ $hostname/";
}
rsync split / /, "-avv --files-from /tmp/$hostname.list root\@$hostname:/ $hostname/";
}
+sub mkbasedir {
+ my $path = shift;
+ $path =~ s{/[^/]+$}{};
+ warn "# mkpath $path\n";
+ mkpath $path || die $!;
+}
+
while (my $client = $server->accept()) {
my $line = <$client>;
chomp($line);
while (my $client = $server->accept()) {
my $line = <$client>;
chomp($line);
@@
-264,8
+271,18
@@
while (my $client = $server->accept()) {
print $client `git show $rel_path`;
} elsif ( $command eq 'grep' ) {
print $client `git log -g --grep=$rel_path`;
print $client `git show $rel_path`;
} elsif ( $command eq 'grep' ) {
print $client `git log -g --grep=$rel_path`;
+ } elsif ( $command eq 'link' ) {
+ if ( $on_host ) {
+ mkbasedir "$on_host/$path";
+ rsync( '-avv', "root\@$on_host:$path", "$on_host/$path" );
+ mkbasedir "$hostname/$path";
+ link "$on_host/$path", "$hostname/$path";
+ rsync( '-avv', "$hostname/$path", "root\@$hostname:$path" );
+ } else {
+ print $client "ERROR: link requires host:/path\n";
+ }
} else {
} else {
- print $client "
U
nknown command: $command\n";
+ print $client "
ERROR: u
nknown command: $command\n";
}
close($client);
}
close($client);