Commit 8e5b2b2a authored by Leigh B Stoller's avatar Leigh B Stoller

Initialize the image password from the supplied password when running

emulab-install, or from the current root password.
parent 0a0217b7
......@@ -4,6 +4,7 @@
use strict;
use libinstall;
use installvars;
use emutil;
my $MFSTARBALL = "tftpboot-elabinelab.tar.gz";
my $MFSURL = "http://www.emulab.net/downloads/$MFSTARBALL";
......@@ -100,6 +101,50 @@ sub Install($$$)
}
};
#
# Before we localize, need to set the MFS password sitevar,
# since localize will break otherwise.
#
Phase "password", "Setting up MFS password", sub {
my $passhash;
my ($status, @output) =
ExecQuiet("$PREFIX/sbin/setsitevar -c $IMAGEPASSWORDSITEVAR");
PhaseFail("setsitevar failed")
if ($status);
if (@output) {
chomp($output[0]);
PhaseSkip("already set")
if ($output[0] ne "");
}
#
# Use the same password for everything.
#
if (defined($password)) {
$passhash = PassWordHash($password);
}
else {
#
# Use current root password, since we know people will
# choose reasonable root passwords.
#
($status,@output) =
ExecQuiet("egrep '^root:' /etc/master.passwd");
PhaseFail("egrep failed")
if ($status);
if (@output && $output[0] ne '' &&
$output[0] =~ /^root:([^:]*)/) {
$passhash = $1;
}
}
PhaseFail("Could not determine image password")
if (!defined($passhash));
ExecQuietFatal("$PREFIX/sbin/setsitevar ".
" $IMAGEPASSWORDSITEVAR '$passhash'");
};
#
# Localize the MFSs
#
......
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