Tuesday, 10 August 2010

LAP - X - Part 2, Variables

OK, we have our files downloaded, now it is time to install them. We are going to have to do this via script, because the commands are so damned complicated it would be asking for trouble to have to type them into the command line by hand.

I will write the blog post from the point of view of having actually booted from the Amiga Key, but remember before you run the commands to create the script you need to boot from the LiveCD and run these commands:

umount -v /media/amiga
sudo mkdir /media/lfs
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs
cd /media/lfs/sources

So, that reminder over, the first thing that we have to do is to set two environment variables. The first tells the system where X is installed, and the second contains a number of [configure] options and will save us from having to type them in each time we configure a package. What I am going to do is set these variables, BUT ALSO add them to the [/etc/profile] file so that they will remain set even if I reboot.

export XORG_PREFIX="/usr"

I have decided to install into [/usr] as with all the other system software. The book did give me the choice between there or [/opt]. DO NOT RUN this command from the LiveCD, it needs to be run from the Amiga Key.

export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var"

The actual options that we are setting here are fairly self explanatory.

Now lets have a script for this:

sudo cat > set_0_xorg_stuff.sh << "ARSE" 
cat >> /etc/profile.d/X.sh << "EOF"
# Begin Xorg Variables
export XORG_PREFIX="/usr"
export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var"
# End Xorg variables
echo "Remember to now exit and log back in to allow these changes to take place.  Then run ~/inst_1_proto.sh"
chmod +x ./set_0_xorg_stuff.sh
sudo mv ./set_0_xorg_stuff.sh /media/lfs/root

Note in my script I used [>>] to add those commands to /etc/profile.d/X.sh, rather than over writing it entirely. Once you have run the script, log out and log in again and use [echo] to check the [$]variables. I have put a reminder to myself in the last line of the script. When I run it it will end with that message. The idea is that rebooting all the time to make new scripts is a pain in the arse, and it would be most efficient to make all of the Xorg Scripts in one go, reboot to the key and then run them one at a time. That would be tricky if we didn't keep a track in the scripts themselves of which script comes next.

No comments:

Post a Comment