Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
24b8c3d4
Commit
24b8c3d4
authored
Apr 02, 2010
by
Mike Hibler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add '-l' option to list the current settings of the various boot osid fields.
parent
e686364c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
tbsetup/os_select.in
tbsetup/os_select.in
+31
-4
No files found.
tbsetup/os_select.in
View file @
24b8c3d4
...
...
@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-200
9
University of Utah and the Flux Group.
# Copyright (c) 2000-20
1
0 University of Utah and the Flux Group.
# All rights reserved.
#
...
...
@@ -18,12 +18,13 @@ Usage: os_select [-h] [-d] [-c] [-1 | -t] [<osid>] <node> [<node> ...]
-1 Apply change to one-time boot field
-t Apply change to temporary boot field
-b Reset to default boot osid. Do not provide an osid.
-l Show the current settings.
osid OS identifier for the selected OS (see web interface for listing)
node Node identifiers (ie pcXX)
EOF
exit
(
-
1
);
}
my
$optlist
=
"
hdc1tb
";
my
$optlist
=
"
hdc1tb
l
";
# un-taint path
$ENV
{'
PATH
'}
=
'
/bin:/usr/bin:/usr/local/bin
';
...
...
@@ -68,6 +69,7 @@ my $oneshot = 0; # apply change to next_boot_osid.
my
$tempmode
=
0
;
# apply change to temp_boot_osid.
my
$clear
=
0
;
# Clear the selected boot (def,temp,next).
my
$default
=
0
;
# Reset back to default osid.
my
$list
=
0
;
# Just list the current settings.
my
@nodes
=
();
my
$osid
;
my
$osinfo
;
...
...
@@ -87,9 +89,10 @@ if (defined($options{"1"})) { $oneshot=1; }
if
(
defined
(
$options
{"
t
"}))
{
$tempmode
=
1
;
}
if
(
defined
(
$options
{"
c
"}))
{
$clear
=
1
;
}
if
(
defined
(
$options
{"
b
"}))
{
$default
=
1
;
}
if
(
defined
(
$options
{"
l
"}))
{
$list
=
1
;
}
# In clearmode, there is no OSID. Just a list of nodes.
if
(
!
(
$clear
||
$default
))
{
if
(
!
(
$clear
||
$list
||
$default
))
{
usage
()
if
(
@ARGV
<
2
);
$osid
=
shift
();
...
...
@@ -131,7 +134,7 @@ if ($UID && !TBAdmin($UID) &&
#
# Grab the info for the OSID.
#
if
(
!
(
$clear
||
$default
))
{
if
(
!
(
$clear
||
$list
||
$default
))
{
$osinfo
=
OSinfo
->
Lookup
(
$osid
);
fatal
("
Improper DB entry for OSID:
$osid
")
if
(
!
defined
(
$osinfo
));
...
...
@@ -143,6 +146,30 @@ elsif ($default) {
foreach
my
$node
(
@nodes
)
{
my
$nodeobject
=
Node
->
Lookup
(
$node
);
# In list mode, show all the IDs
if
(
$list
)
{
my
$tb
=
$nodeobject
->
temp_boot_osid
();
my
$nb
=
$nodeobject
->
next_boot_osid
();
my
$db
=
$nodeobject
->
def_boot_osid
();
print
"
$node
:
";
if
(
$tb
)
{
$info
=
OSinfo
->
Lookup
(
$tb
);
print
"
temp=
$info
";
print
"
,
";
}
if
(
$nb
)
{
$info
=
OSinfo
->
Lookup
(
$nb
);
print
"
next=
$info
";
print
"
,
";
}
if
(
$db
)
{
$info
=
OSinfo
->
Lookup
(
$db
);
print
"
default=
$info
";
}
print
"
\n
";
next
;
}
# The field to change in the DB.
my
$field
=
"
def_boot_osid
";
$field
=
"
next_boot_osid
"
...
...
Write
Preview
Markdown
is supported
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