My original post was:
> Hi, Does anyone out there have a statically linked version of
> the Sun route command? Because of a recent network change we
> had to set up a dataless client on a subnet different that
> its fileserver. This means that before it can mount /usr
> it must first add the required static route to the routing
> table. The code to handle this is in rc.boot:
>
> if [ -f /sbin/route -a -f /etc/defaultrouter ]; then
> route -f add default `cat /etc/defaultrouter` 1
> fi
>
> Setting up the /etc/defaultrouter file is the easy part. The
> hard part is /sbin/route. This does not normally exist in
> /sbin. One would think you could just copy /usr/etc/route
> to /sbin but /usr/etc/route is a dynamically linked program
> which references /usr/lib/usr/lib/libc.so.1.x. This won't
> work because /usr isn't mounted yet. The comments in rc.boot
> mentions that a static version of route is needed but makes
> no mention where one can be obtained, and I can find no
> mention of this in the manuals. I tried looking for the
> source to route on the net and all I could find was several
> sites that carry the BSD sources. I have no idea if this
> will work on a Sun system. I'm going to try to build it
> but I'm not hopeful. If anyone knows where I can get a
> static version of Sun's route command, I'd appreciate
> hearing from you. Thanks very much.
Thanks to those who replied to this. I was eventually pointed
to the source of a route program in the Xkernel package. I compiled
this using
cc -Bstatic -o route route.c
to get the binary I needed.
Incidentally, while I was looking for a place to find the source, I
jury rigged another solution. I copied the standard dynamic route
binary to /sbin and then did a "trace route" to see what libraries
in /usr/lib were referenced. I then created a /usr/lib directory
on the dataless client's root filesystem and copy the /usr/lib
files to this directory. This allowed the dynamic route command
to work properly, even though /usr had not been mounted yet.
When /usr was mounted, it covered up the mini /usr/lib I created
and everyone was happy.
One problem I did encounter is an error in the code above:
> if [ -f /sbin/route -a -f /etc/defaultrouter ]; then
> route -f add default `cat /etc/defaultrouter` 1
> fi
The second line should actually be:
> route -f add default `shcat /etc/defaultrouter` 1
The file rc.boot makes a shell function called shcat to list
files since it doesn't have access to a cat command at this
point in the boot process. This means that Sun has never
actually tested this code under real conditions.
At least I got everything working in the end....
-- Peter Steele Unix Services Manager peter.steele@acadiau.ca Acadia Univ., Wolfville, NS, Canada B0P 1X0 902-542-2201 Fax: 902-542-4364
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:32 CDT