Ceri Davies writes: > On Mon, Jun 16, 2008 at 10:04:42AM -0400, James Carlson wrote: > > > The existing /etc/rc*.d stuff is there so that software that *must* > > run on older versions of Solaris (either because it was originally > > written there and never updated for S10 or newer, or because it's > > still supported on those old versions) can still run. > > > > Since that's the purpose, the constraints of S9 and older here are > > quite important for the discussion. > > > > And on S9, if you put "#!/bin/ksh" at the top of your rc script, it > > won't work. Never has, never will. > > Hmm. I agree that changing it probably isn't a good idea, but there's a > subtle difference on S10 as Nico pointed out explicitly: the only way to > get a binary or non-/bin/sh script to be executed correctly on S10 is to > call it S99foo.sh, which is just plain weird.
Not only weird, but an undocumented side-effect of the implementation. Where does anything say that ".sh" is even supported? > I think that at the very > least this deserves a NOTE in a (which?) manpage, even if it's just a > statement that everything is expected to be /bin/sh scripts. /etc/init.d/README has this documentation. > > Note that these supposed rc scripts could never have been run on S10 > > or anything older, because they won't work. So, they must have either > > never been tested on Solaris at all (in which case it's hard to see > > how they're supported), or they're specifically designed for > > OpenSolaris. > > Who says they're supported? Numerous vendors will quite happily give > you an rc script that runs on Linux and expect you to take it from > there. In my case, my backup guys had used the exact same script on my > Solaris machines as they do on other folk's Linux boxes (#!/bin/bash, > natch). In that case, what you're doing is called "porting." Yes, even if all that you need to do is rewire the rc script because it's not out-of- the-box ready for Solaris, I claim that this is porting. The most trivial but valid port is probably this: cat >/etc/init.d/mything <<EOF #!/sbin/sh /path/to/mything/rc-script $* EOF chmod +x /etc/init.d/mything ln -s ../init.d/mything /etc/rc3.d/S99mything ln -s ../init.d/mything /etc/rcS.d/K00mything ... but there are probably better ports that can be done. I don't think I agree that rewriting the legacy support for rc scripts is a necessary or desirable component of that. It's not clear that it'd even work right, as it obviously assumes that all of the bits install the same way on Solaris as on these other systems (the paths are the same), and may well make many other assumptions. > > For what it's worth, if I were one of those software developers trying > > to make a universal rc script, I'd very much intentionally restrict > > myself to the tiniest subset of Bourne syntax possible, to make sure > > it would work everywhere. It'd just never occur to me to pepper the > > script with ksh-isms like '[[' any more than I'd attempt to use csh > > syntax. > > > > Am I the last careful designer left? :-< > > You miss the point that most of us run software that we've > bought/acquired from other people. It sounds like you're not just "running" it but also porting it as well. -- James Carlson, Solaris Networking <james.d.carlson at sun.com> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677