Violating the hacker ethic

jdavidb on 2002-08-28T15:56:17

Solaris's files in /etc/init.d are not lazy. They should be. They should not do things more than once.

There should be one file in init.d, run early, to perform the task of determining and setting the system's hostname. Any other startup script that wants to know they hostname should then run the hostname command to get it.

There are multiple scripts in init.d that all duplicate some variant of complicated logic saying, "If I started up with DHCP, then ask DHCP what my hostname is, or if I started up with BOOTP, then ask something else what my hostname is, or ....., or else just set it to 'unknown.'" Everything I'm reading has you modifying several of these scripts (don't they get replaced on upgrades?!?!?!) rather than just setting things in one configuration file.

The annoying thing is that complicated logic winds up asking DHCP what the DHCP server supplied for my hostname. That's a legacy assumption: DHCP is not providing my hostname; instead I'm telling DHCP what I'd like my hostname to be. (This is a relatively new innovation for Solaris and apparently not everyone with commit access to /etc/init.d within Sun has been told.) The dhcpinfo command reports that I have no hostname, even though it would make a lot more sense for it to report the hostname I gave to DHCP. (The logic should be "report the hostname DHCP thinks I have" rather than "report the hostname DHCP gave me if it gave one.") Of course, even better is for all these scripts to just call the hostname command. If hostname has to be determined from dhcpinfo, let it be done one time early on and then set from it.

Solaris culture shock today. :)


/etc/init.d/ is not 'solaris'

hfb on 2002-08-28T16:26:31

This is System V. Also, you might find stokely.com helpful as, if you are rebooting for dhcp you are doing it wrong.

Re:/etc/init.d/ is not 'solaris'

jdavidb on 2002-08-28T17:02:10

My point is that the scripts in Solaris's /etc/init.d are not well organized compared to Red Hat, Debian, LFS, etc., particularly in the matter of setting the hostname. It would help if some of the people who wrote those scripts knew you could use DHCP to request a hostname.

if you are rebooting for dhcp you are doing it wrong.

Yeah, I know. :) Someone ought to tell the guy from Sun who wrote that manpage.

Re:/etc/init.d/ is not 'solaris'

hfb on 2002-08-28T18:26:13

Well, linux isn't System V [ it's -ish but, at least the last time I deigned to soil myself by touching Linux, it's a mismash of variants ] and once you get used to the way Solaris does things, it will make some sort of sense. RH and friends seem disorganised to me :)

and manpages? Why, when I was young, we didn't have manpages! We had to go into the basement of the computing center to find the troll-like guy who would speak only in binary ;)