Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
After the work on Runit fairly much tapered off, the code and work has been dormant for a while now. It's far from perfect, but I would like to revive the work in a new way.
1. I want to continue with the usage of run files to allow parallel startup of services using the Runit in it system to it's fullest extent.
2. I want to include a fallback bsd-style init method of startup, not just within Stage 1 of the init, but also Stage 2 and 3 to allow startup and shutdown of services when the bsd-style init is in use.
Any ideas or insight to the project? Questions and comments of all kinds wanted.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Well of course I am willing to help out any way I can, but I no longer use runnit, I now use the busybox init system, but let me know what needs doing.
Mainly, I want to research the modular scripting idea that ArchIgnite and VoidLinux went to while keeping the standard toolkit we supply rather than keep the monolithic stage 1 script. We can use it, but I'd like to have startup and shutdown sequences in each script as needed.
I also want to prepare a new approach to Stage 2. Mainly I want to have it able to launch services in linear mode using bsd-stylized init scripts similar to the Slackware approach, but equally have a switch-off able to launch traditional run files and their appropriate scripts, and try to find a way to have better dependency checks scripted in.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
When you mean a modular scripting, would you mean a simple controlling script that in turn calls an executable script like so:
Code:
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
for i in /etc/rc.d/rc1.d/*
do
if [ -x "$i" ];then
"$i" start
if [ $? -ne 0 ];then
echo "Problem running $i"
/sbin/sulogin
exit 1
fi
fi
done
Which would run all the executable scripts in /etc/rc.d/rc1.d, or do you mean to have a script with a number of non-executable config files that just tells the main script what to run with what aruments and various other info, somthing like this ( warning pseudo code! )
Code:
while not done
load info from config file
execute commands
next
With the config files like so ( again just as an example )
Code:
EXEC=/path/to/command with args etc
RESTARTONKILLED=true
LOGERRORS=true
LOGSTDOUT=false
...
...
That would work nicely. The startup script will start everything 0-99, then a shutdown sequence would run the opposite way 99-0. Simple yet elegant. That would work for the core scripts, but for the service scripts I plan to use the if/else/then method of listed scripts like Slackware to be able to allow for silent non-executable scripts using chmodable init scripts. It seems a bit extra work, but honestly it gives the best control, especially if you wish to switch out to the run files as needed.
My only worry currently is the init-shim toolkit for the binaries halt and pause still being compile ready against the newer GCC releases.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Quote:
Originally Posted by ReaperX7
... but for the service scripts I plan to use the if/else/then method of listed scripts like Slackware to be able to allow for silent non-executable scripts using chmodable init scripts. It seems a bit extra work, but honestly it gives the best control, especially if you wish to switch out to the run files as needed.
My only worry currently is the init-shim toolkit for the binaries halt and pause still being compile ready against the newer GCC releases.
Not too sure what you mean by this as the code snippet above checks the executable but an if not set doesn't run the script, or do hou mean somthing differerent, an example would help
Basically, I want to keep the core init bootscripts inside of /etc/runit/init.d and have the expanded bootscripts for services inside of /etc/runit/rc.d with the Runit specific run files located within /etc/runit/runscripts/
Within Stage 2 I plan to have a trigger such as:
Code:
#!/bin/sh
# Linux From Scratch Runit Stage 2 Bootscript.
# Copyright 2014 James Powell, Keith Hedger, and Stoat of LinuxQuestions.
# Work derived from VoidLinux and Ignite and adapted for LFS.
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
# Setup first tty as unicode again, stage1 does not work correctly for tty1.
unicode_start
# Try and detect if the current runlevel directory has been created yet. It
# should exist as a symlink to the current selected runlevel via runsvchdir.
# If the symlinked service directories are not found, they will be created.
if [ ! -d /etc/runit/runsvdir/current ]; then
pushd /etc/runit/runsvdir
ln -s multi current
popd
fi
# Let runsvchdir select the default runlevel
runsvchdir multi >/dev/null
# The following is a legacy style command to load services using a BSD style
# control script for services that do not work well with the current run files
# or if the user wishes to use a legacy boot method.
if [ -x /etc/runit/rc.d/rc.M ]; then
/etc/runit/rc.d/rc.M
fi
# rc.local is used to load any extras in the system as daemons if Runit hasn't
# covered them with run files, or run programs as daemons not normally used.
[ -x /etc/rc.local ] && /etc/rc.local
# Start all services detected in the current runlevel directory.
exec env - PATH=$PATH \
runsvdir /etc/runit/runsvdir/current 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'
This is but an example only and the true working script may differ.
One thing I want to do is come up with a better way to configure everything.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
One thing you need to watch for is that the /etc/runit/rc.d/rc.M script is not run as well as the runnit scripts as you may end up trying to start the same service twice, most use some sort of file lock but others don't, may be best to try and start using runnit and only use /etc/runit/rc.d/rc.M as a fallback, you would also have to check inside the rc.M script to see if runnit has already started the service correctly.
You may want to look at dialog for configuration, it's a bit pernickerty about arguments but can be run from within a X session or from a terminal, or ssh session, and most people have it installed anyway.
High level toolkits for configs like pygtk are probably not a good idea.
P.S.
Sorry for not replying earlier but just had a major hardware failure on my server.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.