diff --git a/utils/ec2import-image.pl b/utils/ec2import-image.pl index 02a2d4be957aaee1c46a493094a342353adda9b4..12a4e8225bf3c304c3fd18bc55c675a2618e001c 100644 --- a/utils/ec2import-image.pl +++ b/utils/ec2import-image.pl @@ -116,7 +116,15 @@ if(system("echo \"mkdir -p ~/.emulab\" | ssh -o UserKnownHostsFile=/dev/null ". goto cleanup; } -# Remotely execute the export script +# Check if Ruby and unzip exist +if(system("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ". + "$remote 'which ruby unzip'")){ + print STDERR "*** Could not find either ruby or unzip on remote machine!"; + $error = 1; + goto cleanup; +} + +# scp export scripts if(system("scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ". "$TB/sbin/export-template-remote.rb $remote:~/.emulab/export.rb")){ print STDERR "*** Couldn't scp exporter script into $remote\n"; @@ -124,15 +132,14 @@ if(system("scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ". goto cleanup; } -# Check if Ruby exists -if(system("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ". - "$remote 'which ruby unzip'")){ - print STDERR "*** Could not find either ruby or unzip on remote machine!"; +if(system("scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ". + "$TB/sbin/GrubConf.rb $remote:~/.emulab/GrubConf.rb")){ + print STDERR "*** Couldn't scp exporter-grubconf script into $remote\n"; $error = 1; goto cleanup; } - +# Run it! if(system("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ". "-t -t $remote 'sudo ruby -C ~/.emulab < ~/.emulab/export.rb'")){ print STDERR "*** Remote image creation failed\n";