Commit 6c84463a authored by Nigel Kukard's avatar Nigel Kukard

Fix --rsync syntax to be the same as rsync

parent 8b1127db
#!/usr/bin/perl
# awit-ssh - SSH initiator which searches LDAP for host details
# Copyright (c) 2016-2017, AllWorldIT
# Copyright (c) 2016-2019, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -25,7 +25,8 @@ awit-ssh - LDAP lookup utility for SSH hosts.
=head1 SYNOPSIS
awit-ssh < HOST[:PORT]] [--libvirt-vnc HOST:PORT] [--knock HOST:PORT] | --rsync -- remote://[HOST[:PORT]]/full/path DEST >
awit-ssh [--libvirt-vnc HOST:PORT] [--knock HOST:PORT] HOST[:PORT]
awit-ssh --rsync -- [USER@]HOST:path DEST
=cut
......@@ -76,10 +77,10 @@ use User::pwent;
my $NAME = "AWIT-SSH-Client";
our $VERSION = "0.8.10";
our $VERSION = "0.8.11";
print(STDERR "$NAME v$VERSION - Copyright (c) 2016-2018, AllWorldIT\n\n");
print(STDERR "$NAME v$VERSION - Copyright (c) 2016-2019, AllWorldIT\n\n");
=head1 OPTIONS
......@@ -102,7 +103,7 @@ C<awit-ssh> provides the below commandline options...
Knock on HOST:PORT to gain access.
=head2 --rsync remote://<HOST[:PORT]>/full/path DEST
=head2 --rsync <[USER@]HOST:/path> <DEST>
Use rsync to rsync data from remote server to DEST. This can be specified either way around.
......@@ -189,15 +190,11 @@ my $loginUsername;
my $hostSpec;
if (defined($useRsync)) {
foreach my $param (@ARGV) {
# Look for the remote:// param
if ($param =~ /remote:\/\//) {
# Remove it and set the hostSpec
my $removedTag = substr($param,9);
# Look for the : param
if ($param =~ /:/) {
# Assing hostSpec to the first part of the tag
($hostSpec) = split(/[\/:]/,$removedTag);
# Change first / to a :/
$removedTag =~ s,/,:/,;
push(@rsyncParams,$removedTag);
($hostSpec) = split(/:/,$param);
push(@rsyncParams,$param);
# Else just add it
} else {
push(@rsyncParams,$param);
......@@ -205,7 +202,7 @@ if (defined($useRsync)) {
}
# Make sure we got a hostSpec
if (!defined($hostSpec)) {
logger('ERROR',color('magenta')."awit-ssh --rsync needs a remote://SERVER.... to be specified on the command line".
logger('ERROR',color('magenta')."awit-ssh --rsync needs a <HOST:/path> parameter to be specified on the command line".
color('reset'));
exit 1;
}
......@@ -967,8 +964,9 @@ sub displayHelp
{
print(STDERR<<EOF);
Usage: $0 <options> [USER@]HOST
$0 <options> --rsync -- <rsync options> remote://[USER@]HOST/file.name /tmp
$0 <options> --libvirt-vnc HOST:PORT
$0 <options> --knock HOST:PORT [USER@]HOST
$0 <options> --libvirt-vnc HOST:PORT [USER@]HOST
$0 <options> --rsync -- <rsync options> [USER@]HOST:/path/file.name /tmp
General Options:
--help What you're seeing now.
......@@ -1008,7 +1006,7 @@ L<https://gitlab.devlabs.linuxassist.net/allworldit/awit-ssh-client/issues>.
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2016-2017, AllWorldIT
Copyright (C) 2016-2019, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment