X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=bak-git-server.pl;h=5e656a0efb416af808dc26d929983846b2241712;hb=4faf28e5b9db5adabd5005cb2655365774001b55;hp=67262c978e7a7034cf820ea47bae849c389de176;hpb=057442bfae6caf7761c4edad3c82a48cd8fe23a8;p=bak-git.git diff --git a/bak-git-server.pl b/bak-git-server.pl index 67262c9..5e656a0 100755 --- a/bak-git-server.pl +++ b/bak-git-server.pl @@ -55,6 +55,7 @@ $server_ip ||= '127.0.0.1'; my $shell_client = <<__SHELL_CLIENT__; #!/bin/sh +#echo \$USER/\$SUDO_USER $install `pwd` \$* | nc 127.0.0.1 9001 echo \$USER/\$SUDO_USER `hostname` `pwd` \$* | nc $server_ip 9001 __SHELL_CLIENT__ @@ -104,7 +105,7 @@ sub pull_changes { print $files "$_\n" foreach @_; close($files); } - rsync( qw( -avv --files-from /tmp/$hostname.list root\@$hostname:/ $hostname/ ) ); + rsync split / /, "-avv --files-from /tmp/$hostname.list root\@$hostname:/ $hostname/"; } while (my $client = $server->accept()) { @@ -167,6 +168,7 @@ while (my $client = $server->accept()) { $command = 'log --patch-with-stat' if $command =~ m/^ch/; pull_changes( $hostname ) if $command eq 'diff'; if ( $on_host ) { + mkpath $_ foreach grep { ! -e $_ } ( "$hostname/$dir", "$on_host/$dir" ); rsync( '-avv', "root\@$hostname:$path", "$hostname/$path" ); rsync( '-avv', "root\@$on_host:$path", "$on_host/$path" ); open(my $diff, '-|', "diff -Nuw $hostname$path $on_host$path"); @@ -195,6 +197,8 @@ while (my $client = $server->accept()) { print $client $_; } close($file); + } elsif ( $command eq 'ls' ) { + print $client `ls $backup_path`; } else { print $client "Unknown command: $command\n"; }