aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2017-03-28 13:05:39 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2017-03-28 13:05:39 -0400
commit48fc44f497dfe8886dc2ff90123ae6ffb4821157 (patch)
tree017a497955c12c87f600ee3f0a9580e4e324a031
parent3e11ed09a9c4a063b65b9b73de761aaf27f8e6f7 (diff)
downloadkup-48fc44f497dfe8886dc2ff90123ae6ffb4821157.tar.gz
Add support for the "info" subcommand
Currently, it only outputs the kup server version, but can be used for other purposes in the future (such as to give quota info, etc). Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--ChangeLog12
-rwxr-xr-xkup9
-rwxr-xr-xkup-server9
3 files changed, 26 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8be93b9..0ae0823 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,16 @@
+2017-03-28 Konstantin Ryabitsev <mricon@kernel.org> - 0.3.6
+ * Change kup-server so that separate compress/decompress commands can be
+ specified for each compressor. This allows us to use parallelizing
+ compressors such as pigz and pixz without impacting our ability to
+ decompress incoming tarballs.
+ * Add support for the "info" subcommand that outputs the kup server
+ version (plus any additional information, in the future).
+
2017-03-14 Konstantin Ryabitsev <mricon@kernel.org> - 0.3.5
* Add support for "subcmd" option for kup client, for cases where
kup is used with another authZ system relying on ssh (specifically,
gitolite).
* Small typo fixes
- * Change kup-server so that separate compress/decompress commands can be
- specified for each compressor. This allows us to use parallelizing
- compressors such as pigz and pixz without impacting our ability to
- decompress incoming tarballs.
2012-12-10 Konstantin Ryabitsev <mricon@kernel.org> - 0.3.4
* Calculate and log sha256sums of all uploaded files for forensic
diff --git a/kup b/kup
index aa97789..f9e620b 100755
--- a/kup
+++ b/kup
@@ -98,6 +98,7 @@ sub usage($) {
print STDERR " ln|link old_path new_path\n";
print STDERR " rm|del|delete old_path\n";
print STDERR " ls|dir path...\n";
+ print STDERR " info\n";
exit $err;
}
@@ -580,6 +581,12 @@ sub cmd_dir()
}
}
+# INFO command (no arguments)
+sub cmd_info()
+{
+ command('INFO');
+}
+
# Process commands
sub process_commands()
{
@@ -604,6 +611,8 @@ sub process_commands()
cmd_delete();
} elsif ($cmd eq 'ls' || $cmd eq 'dir') {
cmd_dir();
+ } elsif ($cmd eq 'info') {
+ cmd_info();
} else {
die "$0: unknown command: $cmd\n";
}
diff --git a/kup-server b/kup-server
index 8ecf167..8bdab50 100755
--- a/kup-server
+++ b/kup-server
@@ -68,6 +68,8 @@ use Git;
use Digest::SHA;
+my $VERSION = '0.3.6';
+
# Scrub the environment completely
%ENV = ('PATH' => '/bin:/usr/bin',
'LANG' => 'C',
@@ -1257,6 +1259,11 @@ sub do_dir(@)
STDOUT->autoflush(0);
}
+sub do_info()
+{
+ print "kup-server $VERSION\n";
+}
+
sub get_command()
{
local $SIG{'ALRM'} = sub { fatal("Timeout waiting for command"); };
@@ -1306,6 +1313,8 @@ while (defined($line = get_command())) {
delete_path(@args);
} elsif ($cmd eq 'DIR') {
do_dir(@args);
+ } elsif ($cmd eq 'INFO') {
+ do_info();
} elsif ($cmd eq 'DONE') {
last;
} else {