Multi machine access with USB version

Using applications, configuring, problems
Post Reply
Message
Author
MwPhoto

Multi machine access with USB version

#1 Post by MwPhoto »

Hi,

I have multiple machines I use Puppy on and they have a variety of configurations (different monitor, mouse, network types etc). What I want to do is identify the machine and then use the appropriate settings.

I'm pretty sure I can do it with the following process:

1) Get the MAC address of the ethernet card to uniquely identify the PC - not perfect but good enough

2) I use the MAC address as a directory to copy config files ie,
cp /root/localconfig/**MACADDRESS**/dhcpinfo/* /etc/dhcpc/*
cp /root/localconfig/**MACADDRESS**/videomode /etc/videomode

If the MAC hsan't been seen before these files will be deleted so the normal boot process will allow you to configure (for videmode for example)

then at the end of the session I use a similar script to copy them back again.

I can write all the scripts necessary, however I'm not sure how to get them into the startup/shutdown process. Clearly the copying needs to happen very early on so the various devices pick up the right files.

Can anyone help me by identifying where in the rc scripts I can call my stuff?

With this in place it should mean I can take my USB drive and use any machine I like and not worry about the resolutions etc.

I'm happy to feed these back to the main development stream if this is thought to be a useful feature.

Malcolm

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Pup in boots

#2 Post by Lobster »

/etc/rc.d/rc.local

Place your script on the end of this list of files you wish to call

Look forward to seeing what you come up with

Good Luck - I like it already - Good plan

:)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

nduanetesh
Ultra Super-stud
Posts: 168
Joined: Fri 06 May 2005, 02:36

#3 Post by nduanetesh »

Hi Malcolm!

I think you and I are working toward the same goal. See my thread, here. But I think your method is far more elegant than my idea. I know that it's late in the boot process, but usually when you want to make certain hardware settings permanent, you add lines to /etc/rc.d/rc.local. Do you think it's too late in the boot process? At least it is called before X starts.

ND

MwPhoto

Long post about multi-machine start with some scripts

#4 Post by MwPhoto »

Ok,

I've started some scripting that's partly useful, but it has some irritations. Firstly what it does:

1) on startup it checks for the existence of the directory /etc/rc.d/localconfig - if it isn't there it does nothing. This way it the user doesn't want it the script has no effect.

2) second it asks for the machine you are using (I was initially going to use a MAC address to identify the machine but I wasn't sure how far in the boot process we would be so I didn't know if it would work.)

3) it copies /etc/videomode, /etc/mousedevice and /etc/eth0mode for this machine. Any help on other files it would be useful to preserve would be good!

Startup script is currently written in rc.local as far as I can tell this is before xwin starts so we're ok for windows stuff. For the ethernet I down and up the device to make the new settings work.

for the shutdown script it should do the reverse but it will have remembered the machine name.

Now for the irritations

I can't find a suitable place to put the shutdown script, rc.reboot seems to get overwritten - any ideas? At the moment I'm simply running it manually before shutdown, but I would like to automate it.

Anyway for what it's worth i've attached the VERY ALPHA scripts so you can take a look.

To have a go

copy the rc.local script to /etc/rc.d

create a directory /etc/rc.d/localconfig.

For first time 'sanity' I'd also create /etc/currentlocalsetting as a text file with a single word which is the name of your computer (no whitespace) and run rc.localconfigreboot. This will preserve your current settings

At this stage I'd probably recommend just taking a look to see what I'm doing :)

Malcolm

MwPhoto

Further issues

#5 Post by MwPhoto »

One other irritation,

at the moment if it's a new computer then the script deletes the mousedevice etc. I was hoping that this would then revert to default behaviour, however I now realise that rc.local is too late in the boot up process so I am simply deleting files and there will be no defaults left :(

So the start script will have to be earlier in rc.sysinit

How can I change these files so they stay changed while I'm in the development process?

Malcolm

nduanetesh
Ultra Super-stud
Posts: 168
Joined: Fri 06 May 2005, 02:36

#6 Post by nduanetesh »

HI Malcolm,

The readme.txt file found in /etc/rc.d/ says that rc.sysinit, rc.modules, and rc.update are all loaded from image.gz upon boot, though there are copies in /etc/rc.d/ So, you'd have to edit them inside image.gz, or somehow get puppy to load them from somewhere other than image.gz. The readme file goes on to say:

"Those marked as "pristine" [the three listed above] are run from the image.gz file, although you will find copies of them in /etc/rc.d/. The rest are editable, and are actually located at
/root/.etc/, as /etc is just a symlink to there.
What happens at bootup is firstly image.gz is loaded into
the ramdisk, and rc.sysinit will execute.
A partition is mounted on /root, and /etc is then relinked
to point to /root/.etc -- hence by the time rc.local0
executes, it is from the mounted partition."

So, from the sounds of that, it's going to be tricky to edit rc.sysinit and make your changes stick...

Any of the really smart people have any ideas?

ND

Post Reply