Other Help Topics :: XFree86.dsl automated script for 2 different pc's



Hello yall,

I am using Xfree86.dsl and it works great. (great job Henk!) Now i need to make a script  (or two) that i can run when i use my usb-stick on a different PC.

First line of this script:

install Xfree86.dsl (i don't know the command to do this)

Got the second line down already:

cp .xserverrcGforce ~/.xserverrc (or) cp .xserverrcX ~/.xserverrc (i use my stick on 2 pc's, one with a Gforce 4 mx videocard and one with a intel videocard (onboard)

Third line:

After copying/changing the .xserverrc i need to exit x/Xfree and go back to the new xserver. I haven't figured out yet how to put this in a script...

Do you know?

Patrick:

The command to work for your " install XFree86.dsl would be...

mydsl-load XFree86.dsl

73
ke4nt

You could add 'killall fluxbox' and 'startx', but that's kinda messy in my opinion.
What I'd do is remove 'startx' from .bash_profile, and put it at the end of your script instead.
With this method you'll boot to a console.  Since you plan to shut down fluxbox right after it starts, you're better off just waiting to start it until after xfree is installed.

One script is enough, by the way.  You can pass an argument to it which it uses to decide which xserverrc to use.  Something like this should work:

Code Sample

ARG="$1"
case $ARG in
g|gforce|G|Gforce)
cp ~/.xserverrcGforce ~/.xserverrc
;;
x|X)
cp ~/.xserverrcX ~/.xserverrc
;;
*)
echo "please specify g or x"
exit 0
;;
esac
exec startx


You'd start it with 'scriptname x' or 'scriptname g'

Another thing you can do is put the contents of your rc files into the script rather than backing up and restoring 2 additional files.   With this method you'd use echo or cat with a redirect rather than using cp.  Something like this:
Code Sample

case $ARG in
g|gforce|G|Gforce)
echo "contents of Gforce file" > $HOME/.xserverrc
;;

or
Code Sample

case $ARG in
g|gforce|G|Gforce)
cat << EOF > $HOME/.xserverrc
Some stuff to put in xserverrc.
more stuff.
it will copy everything until it reads this:
EOF
;;

I am doing something wrong...
**********************************************
#!/bin/bash
mydsl-load /mnt/hdb8/XFree86.dsl
ARG="$1"
case $ARG in
g|gforce|G|Gforce)
rm ~/.xserverrc
cp /cdrom/keep/scriptjes/.xserverrcGforce ~/.xserverrc
;;
x|X)
rm ~/.xserverrc
cp /cdrom/keep/scriptjes/.xserverrcX ~/.xserverrc
;;
*)
echo "please specify g or x"
exit 0
;;
esac
exec startx
*****************************************************

This script is called "go" and is in my /home/dsl

It doesn't run right (yet)


Any tips?

I don't know yet.  I know that busybox has some different tools than gnu-utils, and as a result I sometimes need to modify my scripts even if they work fine on another system.

Could be rm is failing for some reason.  I'd use 'cp -f' instead.  Or it could be a syntax error that I just don't see.

Are you getting any error messages?  That would help a lot.

Next Page...
original here.