|
|
scripting eeprom devalias command - hellup!
I am trying to script the OBP devalias config; typically froma command
line I would use
# eeprom "nvramrc=devalias rootdisk <path>"
# eeprom "use-nvramrc?=true"
and everything is fine.
However if I script this as follows
#!/bin/sh
eeprom "nvramrc=devalias rootdisk <path>"
eeprom "use-nvramrc?=true"
the first line instead ends up setting a variable named nvramrc,
although the second line apparently works fine!!
e.g
(from eeprom output).
use-nvramrc?=true
nvramrc=devalias rootdisk <path>
How can I script this correctly? Presumably its something to do with
the amount of " marks needed?
ian
|
|
0
|
|
|
|
Reply
|
didds2
|
6/28/2004 12:27:05 PM |
|
In article <c56a0f39.0406280427.342c4846@posting.google.com>,
didds2@excite.com (Ian Diddams) writes:
> I am trying to script the OBP devalias config; typically froma command
> line I would use
>
> # eeprom "nvramrc=devalias rootdisk <path>"
> # eeprom "use-nvramrc?=true"
>
> and everything is fine.
>
> However if I script this as follows
>
> #!/bin/sh
> eeprom "nvramrc=devalias rootdisk <path>"
> eeprom "use-nvramrc?=true"
>
> the first line instead ends up setting a variable named nvramrc,
> although the second line apparently works fine!!
>
> e.g
> (from eeprom output).
> use-nvramrc?=true
> nvramrc=devalias rootdisk <path>
>
> How can I script this correctly? Presumably its something to do with
> the amount of " marks needed?
When I list mine, I see an extra newline after the nvramrc contents:
[...]
use-nvramrc?=true
nvramrc=devalias bootdisk /pci@1f,0/ide@d/disk@0,0
devalias mirror /pci@1f,0/ide@d/disk@2,0
[...]
I'd expect if you did something like:
eeprom "nvramrc=devalias rootdisk <path>
"
eeprom "use-nvramrc?=true"
you'd probably be ok.
BTW, you can list all active device aliases by digging them out of
"prtconf -pv" output; that includes both builtin ones and ones from
devalias commands that have actually been executed since last reset
(or maybe just since before last reboot, depending on whether or not
"prtconf -p" reports current or cached PROM configuration info).
Here's what I use to do that - started out life as an awk script, converted
via a2p and cleaned up a bit, since awk couldn't handle the long lines, and
I'm a slow starter in perl.
============================ cut here ============================
#! /bin/sh
/usr/sbin/prtconf -pv | perl -e '
$\ = "\n";
while (<>) {
chomp;
@Fld = split(" ", $_, 9999);
if ($Fld[0] eq "name:" && $Fld[1] eq "'"'"'aliases'"'"'") {
$hit = 1;
}
if ($_ eq "") {
if ($hit) {
for ($X = 0; $X < $nr; $X++) {
print $txt[$X];
}
exit;
}
$hit = 0;
$nr = 0;
}
elsif ($Fld[0] ne "name:" && $Fld[0] ne "Node") {
s/^ *//;
s/: *'"'"'/ /;
s/'"'"'$/ /;
$txt[$nr++] = $_;
}
}'
============================ cut here ============================
--
mailto:rlhamil@smart.net http://www.smart.net/~rlhamil
|
|
0
|
|
|
|
Reply
|
Richard
|
6/28/2004 12:55:33 PM
|
|
Ian Diddams <didds2@excite.com> wrote:
> I am trying to script the OBP devalias config; typically froma command
> line I would use
> # eeprom "nvramrc=devalias rootdisk <path>"
> # eeprom "use-nvramrc?=true"
> and everything is fine.
Okay.
> However if I script this as follows
> #!/bin/sh
> eeprom "nvramrc=devalias rootdisk <path>"
> eeprom "use-nvramrc?=true"
> the first line instead ends up setting a variable named nvramrc,
> although the second line apparently works fine!!
> e.g
> (from eeprom output).
> use-nvramrc?=true
> nvramrc=devalias rootdisk <path>
How is this wrong? That looks correct to me.... I think I'm missing
what you're saying.
--
Darren Dunham ddunham@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
|
|
0
|
|
|
|
Reply
|
Darren
|
6/28/2004 4:01:21 PM
|
|
|
2 Replies
1064 Views
(page loaded in 0.128 seconds)
|
|
|
|
|
|
|
|
|