You are not logged in.

#1 2006-12-07 06:39:40

cromero
Member
From: seattle
Registered: 2006-07-22
Posts: 22

automated rc.conf editing (daemons,modules)

I created a script using python to easy edit the rc.conf. It allows you to see and modify the modules and the daemons array with a little coloring. It helps you to add or del an entry in the modules or the daemons array and you can tell the script where you want that item to be added.

To sum up, you can do things like this:
rc-config daemons add ipw3945d before network

It will work no matter if network has a prefix such as @ or ! and even makes a backup every time the configuration file is modified

I hope some people finds it interesting and helpful and start using it and give me feedback. Right now it is only a single file but as it starts getting bigger (if it does) i'll make a package and put it in aur

you can download it here:
http://www.gia.usb.ve/~cesar/rc-config/rc-config.py
or here:
http://blender.homelinux.org/~cesar/rc- … -config.py

Offline

#2 2006-12-07 08:31:48

rabid_dog
Member
Registered: 2006-06-07
Posts: 23

Re: automated rc.conf editing (daemons,modules)

It seems for me that Arch's rc.conf is simplier than anything i seen before.

Offline

#3 2006-12-07 08:57:56

Acid7711
Member
From: Chicago, IL
Registered: 2006-08-18
Posts: 300
Website

Re: automated rc.conf editing (daemons,modules)

I think it would be able to be nice to implement it to automatically make changes by merging packages in. However, some people might not like the idea of auto updating it.

I do agree though, rc.conf is extremely easy to update, but I could see this use being a valid reason to have it.

Offline

#4 2006-12-07 09:25:58

onearm
Member
From: Anywhere but here
Registered: 2006-07-06
Posts: 359
Website

Re: automated rc.conf editing (daemons,modules)

It could be very helpful for new arch users, not much for "expert" archers. Anyway, better having more ways to do the same thing than only one (I agree that editing rc.conf is extremely straightforward).


To get something done, a committee should consist of no more than three persons, two of them absent.
--
My Github

Offline

#5 2006-12-07 12:41:48

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: automated rc.conf editing (daemons,modules)

kris|~$ ./rc-config.py
Traceback (most recent call last):
  File "./rc-config.py", line 166, in ?
    c=RC('rc.conf')
  File "./rc-config.py", line 40, in __init__
    self.file=open(filename).read()
IOError: [Errno 2] No such file or directory: 'rc.conf'

Anyway... I cannot possibly see why we should hide the /etc/rc.conf from the user in a way like this. It will only add complexity and obscure something which doesn't need to be obscured because it's not complicated in the first place. But maybe you can use this idea for something else...


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#6 2006-12-07 15:15:46

cromero
Member
From: seattle
Registered: 2006-07-22
Posts: 22

Re: automated rc.conf editing (daemons,modules)

The way u see it all you guys have a common and valid point of view: "It's already simple", and i agree with you. I don't use the script to make it simpler, i use it to make it faster and to manage my daemons the way other distros do. Even though it's really simple, i don't enjoy to:

open the file in my editor
go to the line im looking for
get to the column where i want to add/del the daemon/module
edit, save and close


I dont believe this will obscure the way things work beacause, as you say, it really is simple. The file remains the file im just using a different way to modify it.

test1000: error fixed, changed 'rc.conf' for '/etc/rc.conf', i used a local copy to test the script (of course)

PS: thanks for the comments and voting

Offline

#7 2006-12-07 22:16:39

Acid7711
Member
From: Chicago, IL
Registered: 2006-08-18
Posts: 300
Website

Re: automated rc.conf editing (daemons,modules)

Yeah, but usually I push F2 that I have set to open bash, su, nano /etc/rc.conf, push page down 3 times and bam I'm right there.  The other thing is, I've only really edited my rc.conf file once, that was the during the install. After that I'm pretty much set and done in my settings.

I like the idea, I think it would be nice to see something like that implemented or optional for like, using pacman to install alsa or something similar ya know?

Offline

#8 2006-12-07 22:27:33

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: automated rc.conf editing (daemons,modules)

Like all say, rc.conf is really easy to modify.  I would be embarassed to use the script as is without knowing exactly the sequence of my stuff in DEAMEONS.  So what about adding something like rc-config --list

I kind of like Acid7711's approach.  I would like to know how you did your F2 thing.

Offline

#9 2006-12-08 00:45:49

noriko
Member
From: In My Mind
Registered: 2006-06-09
Posts: 535
Website

Re: automated rc.conf editing (daemons,modules)

well using the script isn't particularly useful to me
however it is a very nice idea though, i can see myself using some time in the future... it beats having to press [f2] and type the location of the rc.conf [return] and then scrolling to the bottom lol

i'm lazy ..
i.e i wrote a bash function called rc, to do
/etc/rc.d/$@ ;;; certainly bats typing 10bytes

and it is useful to look at the code, as i plan to study python during my Christmas break,
having just gotten used to the python syntax, after much bitching about it lol

thx x)


The.Revolution.Is.Coming - - To fight, To hunger, To Resist!

Offline

#10 2006-12-08 17:01:56

cromero
Member
From: seattle
Registered: 2006-07-22
Posts: 22

Re: automated rc.conf editing (daemons,modules)

marxav wrote:

Like all say, rc.conf is really easy to modify.  I would be embarassed to use the script as is without knowing exactly the sequence of my stuff in DEAMEONS.  So what about adding something like rc-config --list

I kind of like Acid7711's approach.  I would like to know how you did your F2 thing.

Thanks for the comment. There is already a "show" action implemented, use --help or -h for documentation. The show action works like this:

[root@blender ~]# rc-config.py daemons show
DAEMONS=(syslog-ng !hotplug !pcmcia ipw3945d network @dyndns @ntpdate @sshd @httpd @svnserve !netfs crond @laptop-mode alsa dbus @hal keytouch lisa kdm )

or

[root@blender ~]# rc-config.py modules show
MODULES=(!usbserial snd-hda-intel sg)

PS: the F12 thing comes default with yakuake (pacman -S yakuake), which also includes tabs

Offline

#11 2006-12-09 05:08:52

Acid7711
Member
From: Chicago, IL
Registered: 2006-08-18
Posts: 300
Website

Re: automated rc.conf editing (daemons,modules)

marxav wrote:

I kind of like Acid7711's approach.  I would like to know how you did your F2 thing.

Thanks smile
All I have that setup to do is a shortcut key to open bash under Gnome. Nothing more. smile

Offline

#12 2006-12-09 08:40:26

noriko
Member
From: In My Mind
Registered: 2006-06-09
Posts: 535
Website

Re: automated rc.conf editing (daemons,modules)

i typed my one wwrong. i meant [alt]+[f2];;
but u can easily set hotkeys using xkeyboard

pacman -S xkeyboard-config

that a gui frontend to it...


The.Revolution.Is.Coming - - To fight, To hunger, To Resist!

Offline

#13 2006-12-09 16:04:45

Acid7711
Member
From: Chicago, IL
Registered: 2006-08-18
Posts: 300
Website

Re: automated rc.conf editing (daemons,modules)

noriko wrote:

it beats having to press [f2] and type the location of the rc.conf [return] and then scrolling to the bottom lol

Let's sit and count how many key presses each does to do the same thing here. Remember, the Page Down key is your friend here. And yes, I have my bash set to just F2, not alt+F2.

We'll look at it starting from a bash terminal starting with root access since in either case you're still going to need to have root access.


Editing it by hand adding 'alsa' before gdm: You're looking at 35 keypresses. This is what I did. (nano /etc/rc.conf, 1 arrow key up, 4 arrow key left (placing it right before gdm), after 2 presses of "Page Down", and a control-x-y to close nano. This includes all spaces and pushing enter key.

Using the script to add 'alsa' before gdm as I did by hand above: You're looking at 38 key presses for (rc-config daemons add alsa before gdm)  This includes all spaces and pushing enter key.  Keep in mind this (as far as I'm understanding from the info he posted) is doing the exact same thing the manual way is.

Using the script to add 'alsa' whereever it chooses: You're still looking at 27 key presses for (rc-config daemons add alsa) Again,  this includes all spaces and pushing enter key.


The extra couple key presses that would be saved by letting it put 'alsa' wherever it's coded too aren't worth it to me because I'd want alsa where I'd want it to load at. I'm sure anyone else would want the same.  By comparing the two that put 'alsa' where I'd want it, the manual way uses less key presses by far.


Honestly, I don't understand people's need for an excuse to make more work or make work harder for themselves.  Imo, a lot of people spend a lot of time learning and doing new ways to do things that are 'shortcuts' that really aren't anything but that exact opposite. I'm not saying this script was a bad idea, but I think it has a much better place in the automated world as opposed to manually using it. In an automated script where you already have root access and want to automate something, great idea. For sitting there having to gain root access and typing a command out to add something to it it's not practical because you're doing MORE work than you would be doing other wise. JMO. :mrgreen: No offense. I think it was still a good idea, just the use of it needs to be better defined.

Offline

#14 2006-12-09 16:14:13

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: automated rc.conf editing (daemons,modules)

Anyway, back to "basic" lol

cat /etc/rc.conf|grep 'DAEMONS'|grep -v '#'

Offline

#15 2006-12-09 22:58:21

cromero
Member
From: seattle
Registered: 2006-07-22
Posts: 22

Re: automated rc.conf editing (daemons,modules)

The comparison is of course valid, but i think is isn't exactly what determines wether my method is faster than the manual edit.

I think it should be clear to anybody here that time tells us how fast something is. Do i need to convince you that the oneliner method is faster than the nano method?... i believe not.

Plus... counting keypresses doesn't exactly measure how comfortable the method is, specially when you don't even need to type the whole command because using tab completion reduces the keypresses to 32 in the long case. And we all know that just typing words is faster and more comfortable than editing a file with nano where btw the keypresses depend of course on the order of the daemons and the amount of them.

I of course prefer my method and that is why i brought it here, and if someone has a recomendation or a new idea where something like this could be used please let me know, i'd be happy to help.

Offline

#16 2006-12-11 12:58:27

noriko
Member
From: In My Mind
Registered: 2006-06-09
Posts: 535
Website

Re: automated rc.conf editing (daemons,modules)

..I created a script using python to easy edit the rc.conf....

we've driftede from the point lol...
the idea AFAICS, was convenience, not speed...


The.Revolution.Is.Coming - - To fight, To hunger, To Resist!

Offline

#17 2006-12-11 19:24:37

cromero
Member
From: seattle
Registered: 2006-07-22
Posts: 22

Re: automated rc.conf editing (daemons,modules)

Isn't more convenient to minimize the time you need to accomplish something? i think it is, especially if the slower method means doing it by hand.

Offline

#18 2006-12-11 19:26:44

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: automated rc.conf editing (daemons,modules)

I have a nice way to keep my DAEMONS line nicely organised...

DSYS="@syslog-ng @acpid @clamav @crond @cups @sensors @smartd"
DNET="network @iptables @httpd @openntpd portmap @sshd"
DMAIL="fam authdaemond @courier-imap @postfix"
DMISC="@alsa @bluetooth dbus hal @hplip @gpm"
DAEMONS=(${DSYS} ${DNET} ${DMAIL} ${DMISC})

Yup.  A lot of daemons...


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#19 2006-12-11 19:41:57

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: automated rc.conf editing (daemons,modules)

noriko, yes I guess we are diverting lol.  And to me, convenience has all its importance, probably over speed under some circumstances.  and speaking about this. I like chrismortimore idea of organizing daemons.  It is convenient  lol

Offline

#20 2006-12-12 05:10:05

Acid7711
Member
From: Chicago, IL
Registered: 2006-08-18
Posts: 300
Website

Re: automated rc.conf editing (daemons,modules)

cromero wrote:

The comparison is of course valid, but i think is isn't exactly what determines wether my method is faster than the manual edit.

I think it should be clear to anybody here that time tells us how fast something is. Do i need to convince you that the oneliner method is faster than the nano method?... i believe not.

Plus... counting keypresses doesn't exactly measure how comfortable the method is, specially when you don't even need to type the whole command because using tab completion reduces the keypresses to 32 in the long case. And we all know that just typing words is faster and more comfortable than editing a file with nano where btw the keypresses depend of course on the order of the daemons and the amount of them.

I of course prefer my method and that is why i brought it here, and if someone has a recomendation or a new idea where something like this could be used please let me know, i'd be happy to help.

The real point of what I was getting at is that everything is subjective. I wasn't trying to upset you, you wanted opinions, I gave mine. I can hop in and hop back out manually in a matter of seconds.  You or someone else for example, might not be able to do that, whatever. Not really a question of the 'speed' of the app, but rather the user.


Speed is subjective. 'Faster and slower than' means nothing to the masses, it only means something to the individual.


Once again, I meant no offense.  I wasn't trying to hut your feelings. I meant well and I stated where I thought where your creation would shine the most. Simple as that. I wasn't bashing it, because I think it's a decent idea and good work. I was just showing what I'd personally think to use it for. Everyone's different and so are their opinions. smile

Offline

#21 2006-12-13 02:27:59

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: automated rc.conf editing (daemons,modules)

chrismortimore wrote:
DSYS="@syslog-ng @acpid @clamav @crond @cups @sensors @smartd"
DNET="network @iptables @httpd @openntpd portmap @sshd"
DMAIL="fam authdaemond @courier-imap @postfix"
DMISC="@alsa @bluetooth dbus hal @hplip @gpm"
DAEMONS=(${DSYS} ${DNET} ${DMAIL} ${DMISC})

It's... it's beautiful. *wipes tear from eye*
I love to see stuff like this.


psearch - manipulate and refine pacman searches

Offline

#22 2006-12-13 08:56:18

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: automated rc.conf editing (daemons,modules)

wrythe wrote:

It's... it's beautiful. *wipes tear from eye*
I love to see stuff like this.

Heh, thank ye.  For ages I had a giant list, then realised that everything was actually just variables for a script, and thought "Huzzah! Time to make things uber-tidy!"


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#23 2006-12-13 17:26:24

noriko
Member
From: In My Mind
Registered: 2006-06-09
Posts: 535
Website

Re: automated rc.conf editing (daemons,modules)

lol hehe chris (hope u don't mind me calling u that)
i'd have never thought of doung that in a million -1 years lol....


The.Revolution.Is.Coming - - To fight, To hunger, To Resist!

Offline

Board footer

Powered by FluxBB