Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
4315628a
Commit
4315628a
authored
Jul 20, 2013
by
Leigh B Stoller
Browse files
Make admin user optional when baking the image.
parent
b8fb2b71
Changes
1
Hide whitespace changes
Inline
Side-by-side
install/genirack/bakectrl.pl
View file @
4315628a
...
...
@@ -97,8 +97,7 @@ my %configvars = ("address" => undef,
"
forwarders
"
=>
undef
,
"
hostname
"
=>
undef
,
"
timezone
"
=>
undef
,
"
rootpswd
"
=>
undef
,
"
adminuser
"
=>
undef
);
"
rootpswd
"
=>
undef
);
open
(
CN
,
$filename
)
or
Fatal
("
Could not open
$filename
: $!
");
...
...
@@ -211,15 +210,19 @@ if (-e "$MNTPOINT/etc/lastadmin") {
system
("
chroot
$MNTPOINT
/usr/local/bin/mkadmin.pl -r
$lastadmin
")
==
0
or
Fatal
("
Could not add admin user
");
}
unlink
("
$MNTPOINT
/etc/lastadmin
");
}
my
$admin
=
$configvars
{"
adminuser
"};
print
"
Adding admin user
$admin
\n
";
system
("
/bin/cp -f
$pubkey
$MNTPOINT
/tmp/key.pub
")
==
0
or
Fatal
("
Could not copy
$pubkey
to
$MNTPOINT
/tmp
");
system
("
chroot
$MNTPOINT
/usr/local/bin/mkadmin.pl
$admin
/tmp/key.pub
")
==
0
or
Fatal
("
Could not add admin user
");
system
("
echo '
$admin
' >
$MNTPOINT
/etc/lastadmin
");
if
(
exists
(
$configvars
{"
adminuser
"}))
{
my
$admin
=
$configvars
{"
adminuser
"};
print
"
Adding admin user
$admin
\n
";
system
("
/bin/cp -f
$pubkey
$MNTPOINT
/tmp/key.pub
")
==
0
or
Fatal
("
Could not copy
$pubkey
to
$MNTPOINT
/tmp
");
system
("
chroot
$MNTPOINT
"
.
"
/usr/local/bin/mkadmin.pl
$admin
/tmp/key.pub
")
==
0
or
Fatal
("
Could not add admin user
");
system
("
echo '
$admin
' >
$MNTPOINT
/etc/lastadmin
");
}
exit
(
0
)
if
(
!
$snapshot
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment