F. Desktop Installation Code

(This page uses style sheets.)

This code is used to set up a desktop with French as the default language. It uses Red Hat's kickstart program to install and Ximian's Red Carpet to update. It is also tailored for a specific hardware setup and machine configuration, including a particular video card and network configuration; changes would have to be made to cater for the Administration's particular setup. The code shown here is an example only, to show that the functionality can be built, and although it should work, is not guaranteed in any way by netproject.

lang fr_FR

langsupport fr_FR


# Other languages may need other keyboards

keyboard uk


# This defines the type of mouse attached to the client.

mouse --emulthree genericps/2


# This needs changing to the location of the desktop.

timezone --utc Europe/London


# The password shown here would need changing

rootpw --iscrypted $1$7QNhVztt$2/DrxHONbGs91.D5k4rx21

reboot

install


# Change 192.168.1.1 to the IP address of the server.

# Change /mnt/space/RedHat-8.0 to the location on the server of the

# software repository.

nfs --server 192.168.1.1 --dir /mnt/space/RedHat-8.0

bootloader --location=mbr --append vga=0x305

zerombr yes

clearpart --linux --initlabel

part / --fstype ext3 --size 256 --grow --maxsize 512

part /usr --fstype ext3 --size 927 --grow --maxsize 2048

part swap --recommended

network --bootproto dhcp


# Change 192.168.1.1 to the servers IP address

auth --useshadow --enablemd5 --enableldap --enableldapauth --ldapserver 192.168.1.1 --ldapbasedn dc=netproject,dc=com

firewall –disabled


# This might need changing to reflect the monitor being used.

xconfig --depth 16 --resolution 1024x768 --defaultdesktop=GNOME --startxonboot --card "S3 Savage (generic)" --videoram 16384


%packages --resolvedeps

librpm404

redhat-artwork

gnome-session

XFree86

gdm

openoffice-libs

openoffice-i18n

libglade

gdk-pixbuf

GConf

compat-libstdc++

indexhtml

libcapplet0

gdk-pixbuf-gnome

libghttp

mozilla-nss

metacity

nautilus

gnome-panel

control-center

XFree86-75dpi-font

gftp

gedit

emacs

desktop-backgrounds-extra


%pre --interpreter /usr/bin/python

import os, fcntl, CDROM

def eject(file):

try:

f = os.open(file, os.O_RDONLY | os.O_NONBLOCK)

except OSError, (errno, strerror):

print "%s - OS error(%s): %s" % (file, errno, strerror)

return

while 1:

try:

fcntl.ioctl(f, CDROM.CDROMEJECT);

except IOError, (errno, strerror):

print "%s - I/O error(%s): %s" % (file, errno, strerror)

if (errno == 16):

continue

break

os.close(f)

eject("/dev/hda")

eject("/dev/hdb")

eject("/dev/hdc")

eject("/dev/hdd")


%post

/bin/sh << "EOF" >> /root/preboot.log 2>&1

MNT=/mnt/tmp


# Change 192.168.1.1 to the servers IP address

HOST=192.168.1.1

date

mkdir -p $MNT

mount $HOST:/kickstart $MNT -t nfs -o ro

cd $MNT

./postinst.sh preboot

EOF


The code above calls a script called postinst.sh which contains the following:


#!/bin/sh

# description: Installation & upgrade script

# chkconfig: 2345 25 03

# © netproject 2003

# Sean Atkinson, March 2003


SERVICE=postinst


case $1 in

start)

exec $0 postboot >> /root/postboot.log 2>&1

;;

stop)

exit 0

;;

preboot)

rpm -U *.rpm

mkdir /kickstart/

cp -v diffs.patch gdm_bg.png gdm_logo.png /kickstart/

cp -v grub_splash.xpm.gz /boot/grub/

cp -v postinst.sh /etc/rc.d/init.d/$SERVICE

chkconfig --add $SERVICE

exit 0

;;

postboot)

;;

*)

echo "Usage: $0 start|stop|preboot|postboot"

exit 1

;;

esac


# Change 192,168.1.1 to servers IP address. Also details need to reflect

# the actual location and version of the distribution used

HOST=192.168.1.1

RCD=http://$HOST/rcd/

REL=redhat-80-i386


date


# The rpm commands below refer to specific versions of packages. the

# latest versions should be substituted if needed.

rpm -U $RCD/redcarpet/$REL/rcd-1.2.1-1.ximian.3.i386.rpm

cat << EOF >> /etc/ximian/rcd.conf

[Network]

host=$RCD


[Cache]

enabled=false

EOF

service rcd start

rpm -U $RCD/redcarpet/$REL/rc-1.2.1-1.ximian.1.i386.rpm

until rc ping

do

sleep 1

done

rc subscribe $REL redcarpet ximian-evolution

service rcd restart

rpm -e kernel-pcmcia-cs

rpm -e kudzu

rpm -e comps

rpm -e authconfig

until rc ping

do

sleep 1

done

rc update --no-confirmation

for PKG in galeon evolution xpdf vnc vnc-doc openoffice

do

rc install --no-confirmation $PKG

done


# This command assumes a specific release of the java run time

# environemnt

ln -s /usr/java/j2re1.4.1_02/plugin/i386/ns610/libjavaplugin_oji.so \

/usr/lib/mozilla-1.0.1/plugins/

patch -p0 < /kickstart/diffs.patch

chkconfig --del $SERVICE

chkconfig rcd off

for DIR in /tmp /var/tmp

do

rm -rf $DIR

ln -s /dev/shm $DIR

done

reboot


The code above uses the contents of a file called diffs.patch, which contains:


--- gdm.conf 2003-03-25 14:01:20.000000000 +0000

+++ /etc/X11/gdm/gdm.conf 2003-03-25 14:02:38.000000000 +0000

@@ -21,7 +21,7 @@

Chooser=/usr/bin/gdmchooser

DefaultPath=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin

DisplayInitDir=/etc/X11/gdm/Init

-Greeter=/usr/bin/gdmgreeter

+Greeter=/usr/bin/gdmlogin

#Uncomment this for the regular greeter

#Greeter=/usr/bin/gdmlogin --disable-sound --disable-crash-dialog

RemoteGreeter=/usr/bin/gdmlogin

@@ -99,7 +99,7 @@

GlobalFaceDir=/usr/share/faces/

Icon=/usr/share/pixmaps/gdm.xpm

LocaleFile=/etc/X11/gdm/locale.alias

-Logo=


# This assumes the png file exists in the location shown. Change as

# required.

+Logo=/kickstart/gdm_logo.png

## nice RH logo for the above line: /usr/share/pixmaps/redhat/shadowman-200.png

Quiver=true

SystemMenu=true

@@ -114,8 +114,8 @@

PositionY=0

XineramaScreen=0

#Type can be 0=None, 1=Image, 2=Color

-BackgroundType=0

-BackgroundImage=

+BackgroundType=1


# This assumes the png file exists in the location shown. Change as

# required.

+BackgroundImage=/kickstart/gdm_bg.png

BackgroundScaleToFit=true

BackgroundColor=#27408b

BackgroundRemoteOnlyColor=true

--- grub.conf 2003-03-25 14:01:20.000000000 +0000

+++ /boot/grub/grub.conf 2003-03-25 14:01:20.000000000 +0000

@@ -9,7 +9,7 @@

#boot=/dev/hda

default=0

timeout=10

-splashimage=(hd0,0)/boot/grub/splash.xpm.gz


# This assumes the xpm.gz file exists in the location shown. Change as

# required.

+splashimage=(hd0,0)/boot/grub/grub_splash.xpm.gz


# This assumes a particular version of the kernel ie 2.4.18-27.8.0.

# Change all references as needed.

title Red Hat Linux (2.4.18-27.8.0)

root (hd0,0)

kernel /boot/vmlinuz-2.4.18-27.8.0 ro root=LABEL=vga=0x305

--- fstab 2003-03-27 10:52:12.000000000 +0000

+++ /etc/fstab 2003-03-27 10:54:01.000000000 +0000

@@ -1,8 +1,9 @@

LABEL=/ / ext3 defaults 1 1

none /dev/pts devpts gid=5,mode=620 0 0

none /proc proc defaults 0 0

-none /dev/shm tmpfs defaults 0 0

-LABEL=/usr /usr ext3 defaults 1 2

+none /dev/shm tmpfs defaults,noexec 0 0

+LABEL=/usr /usr ext3 defaults,ro 1 2

/dev/hda3 swap swap defaults 0 0

/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0

/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0


# Change 192.168.1.1 to the IP address of the NFS server.

+192.168.1.1:/home /home nfs defaults,noexec 0 0