On Sun, 2007-06-03 at 23:03 +0300, Hussam Al-Tayeb wrote:
> On Sun, 2007-06-03 at 21:48 +0200, Jürgen Hötzel wrote:
> > On Sun, Jun 03, 2007 at 10:10:38PM +0300, Hussam Al-Tayeb wrote:
> > > On Sun, 2007-06-03 at 17:08 +0200, Jürgen Hötzel wrote:
> > > > On Sun, Jun 03, 2007 at 04:40:33PM +0200, Kevin Bader wrote:
> > > > > Nice script, but I don't think such a script is very useful since the 
> > > > > order of 
> > > > > the daemons array is important. So it's better to use an editor I 
> > > > > guess ;-)
> > > > > 
> > > > 
> > > > Yes, this script is just appending, which is OK for most services you 
> > > > add. 
> > > > 
> > > > Implementing order should be easy -> this is left to the reader ;)
> > > > 
> > > > Jürgen
> > > > 
> > > > _______________________________________________
> > > > arch mailing list
> > > > [email protected]
> > > > http://archlinux.org/mailman/listinfo/arch
> > > 
> > > I can do the reordering thing. It's not hard. But I would require a
> > > default list of how the ordering should be. If anyone can provide a list
> > > of all the daemons that Archlinux ships and their correct order, I would
> > > much appreciate this.
> > 
> > Unlike other distros, Arch Linux doesn't have dependency information
> > encoded in init scripts.
> > 
> > I couldn't resist. So I extended my script (inspired by 'chkconfig') do 
> > enable/disable
> > services and allow ordering:
> > 
> > Usage: daemons.sh [-b daemon] add|remove|enable|disable daemon [daemon]...
> > 
> > If you want to add iptables before network:
> > 
> > daemons.sh  -b network add iptables
> > 
> > If you want to disable iptables
> > 
> > daemons.sh disable iptables
> > 
> > Jürgen
> > 
> 
> could you do a:
> 
> elif cat /etc/rc.conf | grep DAEMONS | grep ${member}
>        then echo ${member} is already in startup service list.
> 
> to check if a daemon is already in rc.conf?
> Otherwise it can add a daemon more than once.

The dependency sorting is actually easy. you just make two arrays one
containing the currently enabled daemons and another containing all
daemons archlinux ships with correct order. Then parse array 2 for
things that are also in array 1, and place those items in array 3. Array
2 is sorted by definition so array 3 is now sorted as well. Now empty
the daemons array and refill it with the contents of array 3. 
But as you mentioned, we don't have daemon dependencies so this won't be
of use.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
arch mailing list
[email protected]
http://archlinux.org/mailman/listinfo/arch

Reply via email to