:: Re: [DNG] Mini init script written …
Kezdőlap
Delete this message
Reply to this message
Szerző: Steve Litt
Dátum:  
Címzett: dng
Tárgy: Re: [DNG] Mini init script written in Perl boots.
If the machine were anything but a demonstration experimental machine,
so would I contemplate suicide or systemd. Same with Python, Ruby, and
(urk) Javascript. But truth be told, if PID1 were written in Lua, I
would not be dismayed in the slightest.

SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb



On Thu, 16 Jun 2016 22:47:42 +0200
Irrwahn <irrwahn@???> wrote:

> P.S.:
> For the record: Should I ever find myself sitting at a
> machine running a Perl interpreter for PID1, I'd either
> immediately kill myself or drink the SystemD Kool-Aid
> by the gallon. (The net effect not being that different.)
>
> U.
>
>
> On Thu, 16 Jun 2016 22:28:31 +0200, Irrwahn Grausewitz wrote:
> > On Thu, 16 Jun 2016 22:01:32 +0200, Edward Bartolo wrote:
> >
> >> The Perl script:
> >> ----------------------
> >>
> >> #!/usr/bin/perl -w
> >>
> >> if ($<) {
> >>     printf "Only root can run this program.\n";
> >>     exit 1;
> >> }  

> >
> > The real user ID the script is running under (represented
> > by "$<") should be of no concern. Similar for the effective
> > user ID ("$>").
> >
> > However, and to match Felker's init, it would be a *really*
> > good idea to check for the process ID, and abort if it's not
> > equal to 1, in order to avoid the script running at any
> > time other then system initialization. I believe in Perl
> > that would read something like:
> >
> >   if ($$ != 1) {
> >      exit 1;
> >   }

> >
> > [...]
> >> # We are in the child which must load the operating system by
> >> executing a script
> >
> > One could argue the OS is already running, otherwise there
> > would be no Perl interpreter available to run your script.
> > But that's merely hairsplitting on definition of terms.
> >
> > Regards
> > Urban
> > _______________________________________________
> > Dng mailing list
> > Dng@???
> > https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
> >
>
>
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng