You are not logged in.

#1 2009-11-03 06:03:43

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Using Multiple Different rc.confs

When I'm recompiling my own kernels I like to use different rc.confs for different kernels, namely for speed and/or cleanliness (if I have a module-less kernel I dont want it spitting out errors that it cant find the modules), and the past two methods Ive used I found out can be pretty dangerous. The first method that I was using was rename the old rc.conf to something like rc.conf-original, then rename the new one to rc.conf and once I was done reverse the process. This became a pain and I decided to make a folder to house all of my rc.confs and then make a symlink to whatever one I wanted, which worked fine unless you typed the path wrong (which I seemed to do upon occasion).

I also recently noticed that booting up with one rc.conf and shutting down with a different one didnt make the system too happy since it didnt unmount my HDDs and perpetually marked my ext4 partiton as dirty even though fsck.ext4 said it was clean (it finally fixed itself after about 2 days and multiple fsck's).

Is there an easier (safer) way to handle this?

Offline

#2 2009-11-03 06:16:48

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: Using Multiple Different rc.confs

Why not have one rc.conf and have things that you want to be different between kernels in a switch on uname -r?  For example (untested):

case $(uname -r) in
  *-dirty)
    MODULES=<modules for git kernel>
    ;;
  *-custom)
    MODULES=() # Custom kernel with modules compiled in
    ;;
  *)
    MODULES=<default case>
    ;;
esac

Offline

#3 2009-11-03 15:32:36

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Re: Using Multiple Different rc.confs

I didnt know it was possible to use stuff like that in rc.conf I try it out thanks.

Offline

#4 2009-11-03 16:31:28

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: Using Multiple Different rc.confs

brando56894 wrote:

I didnt know it was possible to use stuff like that in rc.conf I try it out thanks.

Yeah rc.conf just gets sourced by shell scripts.  I have some logic in there to only start kdm if $RUNLEVEL is 5, thus getting the best of the inittab and rc.conf way of starting X.

Offline

#5 2009-11-03 21:51:32

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Re: Using Multiple Different rc.confs

Interesting, I'm half afraid to mess around with system config files that dont already (explicitly) contain shell commands so thats why I didnt try it before. Hell if you have a backup I guess it doesnt hurt to try big_smile

Offline

#6 2010-01-07 21:44:36

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Re: Using Multiple Different rc.confs

Sorry to dig up an old thread but I had this working before and deleted my old rc.conf and I cant get it to work again, what am I doing wrong? The error I'm getting is
test: line 5: syntax error near unexpected token `('
test: line 5: `    echo MODULES=(snd-mixer-oss)'

#!/bin/bash

case $(uname -r) in
  *AR*)
    echo MODULES=(snd-mixer-oss)
    echo mv /etc/X11/xorg.conf /etc/X11/xorg.conf-nvidia
    echo mv /etc/X11/xorg.conf-nouveau /etc/X11/xorg.conf
  ;;
  *)
    echo MODULES=(r8169)
  ;;
esac

this is just a test script, not what im actually going to use in rc.conf

Last edited by brando56894 (2010-01-08 00:37:08)

Offline

#7 2010-01-07 22:37:26

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Using Multiple Different rc.confs

brando56894 wrote:

Sorry to dig up an old thread but I had this working before and deleted my old rc.conf and I cant get it to work again, what am I doing wrong? The error I'm getting is
test: line 5: syntax error near unexpected token `('
test: line 5: `    echo MODULES=(snd-mixer-oss)'

#!/bin/bash

case $(uname -r) in
  *AR*)
    echo MODULES=(snd-mixer-oss)
    echo mv /etc/X11/xorg.conf /etc/X11/xorg.conf-nvidia
    echo mv /etc/X11/xorg.conf-nouveau /etc/X11/xorg.conf
  ;;
  *)
    echo MODULES=(r8169)
  ;;
esac

(this is just a test script, not what im actually going to use in rc.conf)

why are you echoing things?

that code should probably be:

#!/bin/bash

case $(uname -r) in
  *AR*)
    MODULES=(snd-mixer-oss)
    mv /etc/X11/xorg.conf /etc/X11/xorg.conf-nvidia
    mv /etc/X11/xorg.conf-nouveau /etc/X11/xorg.conf
  ;;
  *)
    MODULES=(r8169)
  ;;
esac

Offline

#8 2010-01-08 00:36:05

brando56894
Member
From: NYC
Registered: 2008-08-03
Posts: 681

Re: Using Multiple Different rc.confs

Thanks, but you completely missed the point of the post. this is a test script and the echos are to make sure each case was matched properly, if I didn't echo it how am I supposed to know if it worked or not? wink

It's definitely something to do with the parenthesis (obviously) because after I removed them the script worked perfectly.

Offline

#9 2010-01-08 05:07:42

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: Using Multiple Different rc.confs

Parens are reserved words.  Try echo "MODULES=(snd-mixer-oss)" or echo MODULES=\(snd-mixer-oss\).

Offline

Board footer

Powered by FluxBB