[arch-releng] [PATCH] Adding function for automated script start up at boot

Dieter Plaetinck dieter at plaetinck.be
Mon Feb 28 13:29:10 EST 2011


Charles?
did anything go wrong in our communication?
IIRC this is the last mail on the subject, I never got a reply. It would be a shame to let these changes go to waste.

Dieter


On Sun, 13 Feb 2011 18:29:53 +0100
Dieter Plaetinck <dieter at plaetinck.be> wrote:

> On Tue, 08 Feb 2011 19:46:23 +0100
> Charles Vejnar <ce at vejnar.org> wrote:
> 
> > ---
> >  .../overlay/etc/functions.d/automated_script       |   26 +++++++++++
> >  configs/syslinux-iso/overlay/etc/inittab           |   45 ++++++++++++++++++++
> >  configs/syslinux-iso/overlay/usr/bin/autologin     |    2 +
> >  3 files changed, 73 insertions(+), 0 deletions(-)
> >  create mode 100644 configs/syslinux-iso/overlay/etc/functions.d/automated_script
> >  create mode 100644 configs/syslinux-iso/overlay/etc/inittab
> >  create mode 100755 configs/syslinux-iso/overlay/usr/bin/autologin
> > 
> > diff --git a/configs/syslinux-iso/overlay/etc/functions.d/automated_script b/configs/syslinux-iso/overlay/etc/functions.d/automated_script
> > new file mode 100644
> > index 0000000..5ada69e
> > --- /dev/null
> > +++ b/configs/syslinux-iso/overlay/etc/functions.d/automated_script
> > @@ -0,0 +1,26 @@
> > +. /etc/archiso/functions
> > +
> > +automated_script ()
> > +{
> > +    script="$(cmdline_param script)"
> > +    if [ -n $script ] ; then
> > +        stat_busy "Configuring $script"
> > +        if [[ $script =~ ^http:// || $script =~ ^ftp:// ]] ; then
> > +            wget "$script" -q -O /tmp/startup_script >/dev/null
> > +            rt=$?
> > +        else
> > +            cp $script /tmp/startup_script
> > +            rt=$?
> > +        fi
> > +        if [ $rt -eq 0 ] ; then
> > +            chmod +x /tmp/startup_script
> > +            echo -e "\nif [ \`tty\` = \"/dev/tty1\" ] ; then\n    /tmp/startup_script\nfi\n" >> /root/.bash_profile
> > +            stat_done
> > +        else
> > +            stat_fail
> > +        fi
> > +    fi
> > +}
> > +
> > +add_hook multi_end automated_script
> > +
> > diff --git a/configs/syslinux-iso/overlay/etc/inittab b/configs/syslinux-iso/overlay/etc/inittab
> > new file mode 100644
> > index 0000000..aff6d72
> > --- /dev/null
> > +++ b/configs/syslinux-iso/overlay/etc/inittab
> > @@ -0,0 +1,45 @@
> > +#
> > +# /etc/inittab
> > +#
> > +
> > +#  Runlevels:
> > +#    0    Halt
> > +#    1(S)	Single-user
> > +#    2    Not used
> > +#    3    Multi-user
> > +#    4    Not used
> > +#    5    X11
> > +#    6    Reboot
> > +
> > +## Only one of the following two lines can be uncommented!
> > +# Boot to console
> > +id:3:initdefault:
> > +# Boot to X11
> > +#id:5:initdefault:
> > +
> > +rc::sysinit:/etc/rc.sysinit
> > +rs:S1:wait:/etc/rc.single
> > +rm:2345:wait:/etc/rc.multi
> > +rh:06:wait:/etc/rc.shutdown
> > +su:S:wait:/sbin/sulogin -p
> > +
> > +# -8 options fixes umlauts problem on login
> > +c1:2345:respawn:/sbin/agetty -n -l /usr/bin/autologin -8 38400 tty1 linux
> > +c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
> > +c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
> > +c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
> > +c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
> > +c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
> > +
> > +# Hypervisor Virtual Console for Xen and KVM
> > +#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux
> > +
> > +ca::ctrlaltdel:/sbin/shutdown -t3 -r now
> > +
> > +# Example lines for starting a login manager
> > +x:5:respawn:/usr/bin/xdm -nodaemon
> > +#x:5:respawn:/usr/sbin/gdm -nodaemon
> > +#x:5:respawn:/usr/bin/kdm -nodaemon
> > +#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
> > +
> > +# End of file
> > diff --git a/configs/syslinux-iso/overlay/usr/bin/autologin b/configs/syslinux-iso/overlay/usr/bin/autologin
> > new file mode 100755
> > index 0000000..c124f9e
> > --- /dev/null
> > +++ b/configs/syslinux-iso/overlay/usr/bin/autologin
> > @@ -0,0 +1,2 @@
> > +#!/bin/bash
> > +/bin/login -f root
> 
> can you split your patches?
> one for the autologin as root, then the one to introduce the script support.
> and can you include the 2 sample scripts in a new directory? archiso/examplescripts or something.
> 
> we also need a patch for the official installation guide in the AIF repository, but I can do that myself after this gets merged into archiso.
> 
> Has anyone tested this?  Maybe anyone out there who actually likes to maintain archiso?
> 
> Dieter



More information about the arch-releng mailing list