:: [DNG] Mini init script written in P…
Page principale
Supprimer ce message
Répondre à ce message
Auteur: Edward Bartolo
Date:  
À: Steve Litt, dng
Sujet: [DNG] Mini init script written in Perl boots.
Hi,

The following simple Perl script successfully booted a useable
XFCE4.10 session. Orderly shutdown was done through using "agetty tty1
&", logging in as root in the tty1 terminal, and issuing the command:
"/etc/init.d/rc 0".

The Perl script is this. Please, note this is a very miniscule script
that my require other statements. What I can say, is however, that it
booted successfully without errors and loaded XFCE4.10 that was
useable.

The Perl script:
----------------------

#!/usr/bin/perl -w

if ($<) {
    printf "Only root can run this program.\n";
    exit 1;
}


# Now the fun begins!

# Fork to generate a child process and to allow the parent to reap zombies
my $status = 0;
if (fork()) {
# We are in the parent which must reap zombies.
  while(1) {
      $status = wait();
    }    
} else {
# We are in the child which must load the operating system by executing a script


exec("/sbin/osloader.sh");
}

-----------------------


Edward