summaryrefslogtreecommitdiff
path: root/scripts/vyatta-image-tools.pl
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2014-10-09 21:05:45 +0100
committerAlex Harpin <development@landsofshadow.co.uk>2014-10-09 21:05:45 +0100
commitd843d87120115a6af5be704107bea46b73be5fb1 (patch)
tree7682c71a55d5da7dea3f27797723c5a8bdab0fe3 /scripts/vyatta-image-tools.pl
parent167c2e9c13550ee4867df56344ef3fa6d2fb6bcb (diff)
downloadvyatta-op-d843d87120115a6af5be704107bea46b73be5fb1.tar.gz
vyatta-op-d843d87120115a6af5be704107bea46b73be5fb1.zip
vyatta-op: fix for the config file copy via scp failure
Copying the config file (or any other for that matter via the CLI copy command) to another host via scp fails due to the failure to create the known_hosts file. Bug #340 http://bugzilla.vyos.net/show_bug.cgi?id=340
Diffstat (limited to 'scripts/vyatta-image-tools.pl')
-rwxr-xr-xscripts/vyatta-image-tools.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/vyatta-image-tools.pl b/scripts/vyatta-image-tools.pl
index 8afeccf..6bcfd7d 100755
--- a/scripts/vyatta-image-tools.pl
+++ b/scripts/vyatta-image-tools.pl
@@ -230,7 +230,9 @@ sub curl_to {
chomp $fingerprint;
print "RSA key fingerprint is $fingerprint.\n";
if (prompt("Are you sure you want to continue connecting (yes/no) [Yes]? ", -tynd=>"y")) {
- mkdir "~/.ssh/";
+ if (! -d "$ENV{HOME}/.ssh/") {
+ mkdir "$ENV{HOME}/.ssh/";
+ }
open(my $known_hosts, ">>", "$ENV{HOME}/.ssh/known_hosts")
or die "Cannot open known_hosts: $!";
print $known_hosts "$rsa_key\n";
@@ -257,7 +259,9 @@ sub curl_from {
chomp $fingerprint;
print "RSA key fingerprint is $fingerprint.\n";
if (prompt("Are you sure you want to continue connecting (yes/no) [Yes]? ", -tynd=>"y")) {
- mkdir "~/.ssh/";
+ if (! -d "$ENV{HOME}/.ssh/") {
+ mkdir "$ENV{HOME}/.ssh/";
+ }
open(my $known_hosts, ">>", "$ENV{HOME}/.ssh/known_hosts")
or die "Cannot open known_hosts: $!";
print $known_hosts "$rsa_key\n";