LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 05-21-2016, 06:24 AM   #1
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Question Thinking of reviving Runit-for-LFS.


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.
 
Old 05-21-2016, 10:15 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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.
 
Old 05-21-2016, 07:07 PM   #3
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
Old 05-22-2016, 08:28 AM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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
...
...
 
Old 05-22-2016, 09:41 AM   #5
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
Old 05-22-2016, 01:03 PM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by ReaperX7 View Post
... 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
 
Old 05-23-2016, 05:42 PM   #7
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
Old 05-25-2016, 09:21 AM   #8
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A few lingering issues with Runit-For-LFS ReaperX7 Linux From Scratch 1 11-09-2014 03:23 AM
Request for Runit-For-LFS users. ReaperX7 Linux From Scratch 25 11-03-2014 08:55 PM
runit-for-lfs-1.0rc1 released ReaperX7 Linux From Scratch 0 09-24-2014 12:44 AM
LFS with Runit (without SysV) ReaperX7 Linux From Scratch 119 07-10-2014 03:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration