Subversion Repositories livecd

Rev

Rev 125 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 beyerle@PS 1
#!/bin/bash
2
#
3
# Fix things during bootup - run first 
84 beyerle@PS 4
# For example: Enable services, etc ...
1 beyerle@PS 5
# Executed at the very end of /etc/rc.d/rc.sysinit
6
#
7
# Urs Beyerle, PSI
8
#
9
 
10
### -----------------------------------------------------------
84 beyerle@PS 11
### Definitions
1 beyerle@PS 12
### -----------------------------------------------------------
13
 
14
# dir of mounted /$MOUNTDIR/live
15
MOUNTDIR=livecd
16
 
17
# source functions
18
. /$MOUNTDIR/live/liblinuxlive
19
. /etc/init.d/functions
20
 
21
 
22
### -----------------------------------------------------------
23
### Get boot parameters
24
### -----------------------------------------------------------
25
 
26
# start afs?
27
AFS=$( cmdline_parameter afs )
28
CELL=$( cmdline_value cell )
29
 
30
# or force no afs
31
[ $( cmdline_parameter noafs ) ] && AFS=""
32
 
33
# start ssh server?
34
SSH=$( cmdline_parameter ssh )
35
 
36
# root on NFS?
37
NFSROOT=$( cmdline_value nfsroot )
38
 
39
# PSI setup?
40
PSI=$( cmdline_parameter psi )
41
 
42
# do not start network
43
NONET=$( cmdline_parameter nonet )
44
 
45
# Are PXE/TFTP and NFS Server the same host ? not uesed any more
46
ONEMASTER=$( cmdline_parameter onemaster )
47
 
48
# fast booting ?
49
FASTBOOT=$( cmdline_parameter fastboot )
50
 
51
# if run=rdesktop, we do fast boot
52
if [ "$( cmdline_value run )" = "rdesktop" ]; then
53
    FASTBOOT="fastboot"
54
fi
55
 
56
# start ntpd ?
57
NTPD=$( cmdline_parameter ntpd )
58
 
59
# services on/off
60
SERVICEON=$( cmdline_value serviceon )
61
SERVICEOFF=$( cmdline_value serviceoff )
62
 
88 beyerle@PS 63
# Xserver configurations
64
SCREEN=$( cmdline_value screen )
1 beyerle@PS 65
 
88 beyerle@PS 66
 
1 beyerle@PS 67
### -----------------------------------------------------------
84 beyerle@PS 68
### Configure services
1 beyerle@PS 69
### -----------------------------------------------------------
70
 
71
### disable rpcidmapd, if LiveCD mounted over NFS
72
if [ $NFSROOT ]; then
105 beyerle@PS 73
    chkconfig rpcidmapd off >/dev/null 2>&1
1 beyerle@PS 74
fi
75
 
88 beyerle@PS 76
### disable NetworkManager, if LiveCD mounted over NFS
77
if [ $NFSROOT ]; then
105 beyerle@PS 78
    chkconfig NetworkManager off           >/dev/null 2>&1
79
    chkconfig NetworkManagerDispatcher off >/dev/null 2>&1 
88 beyerle@PS 80
fi
81
 
1 beyerle@PS 82
### disable shutdown of network and nfs, 
83
# if we have the LiveCD mounted over NFS
84
if [ $NFSROOT ]; then
85
    if [ $ONEMASTER ]; then
86
        # "network off" is only necessary, 
87
        # if PXE/TFTP and NTS server is on same machine
88
	chkconfig network off
89
    fi
90
 
128 beyerle@PS 91
    rm -f /etc/rc.d/rc6.d/K*netfs
92
    rm -f /etc/rc.d/rc6.d/K*nfslock
93
    rm -f /etc/rc.d/rc6.d/K*portmap
94
    rm -f /etc/rc.d/rc6.d/K*network
1 beyerle@PS 95
 
128 beyerle@PS 96
    rm -f /etc/rc.d/rc0.d/K*netfs
97
    rm -f /etc/rc.d/rc0.d/K*nfslock
98
    rm -f /etc/rc.d/rc0.d/K*portmap
99
    rm -f /etc/rc.d/rc0.d/K*network
1 beyerle@PS 100
fi
101
 
102
### enable AFS during start up, if given by boot parameter
103
if [ $AFS ]; then
104
    chkconfig afs on
105
fi
106
 
107
### disable some services for fast booting
108
if [ $FASTBOOT ]; then    
109
    echo "Fast booting enabled"
128 beyerle@PS 110
    chkconfig vpnclient_init off  2>/dev/null
111
    chkconfig haldaemon off       2>/dev/null
112
    chkconfig pcmcia off          2>/dev/null
113
    chkconfig ntpd off            2>/dev/null
114
    chkconfig atd off             2>/dev/null
115
    chkconfig cpuspeed off        2>/dev/null
116
    chkconfig gpm off             2>/dev/null
117
    chkconfig messagebus off      2>/dev/null
118
    chkconfig kudzu-auto off      2>/dev/null
1 beyerle@PS 119
fi
120
 
121
### enable ntpd?
122
if [ $NTPD ]; then
123
    chkconfig ntpd on
124
fi
125
 
126
### enable SSH server during start up, if given by boot parameter
127
if [ $SSH ]; then
128
    chkconfig sshd on
129
fi
130
 
84 beyerle@PS 131
### activate ipw3945d daemon, if we have Intel IPW3945 WLAN 
132
if [ ! $NONET ]; then
133
    lspci | grep -q Intel.*3945ABG
134
    if [ "$?" = "0" ]; then
135
	chkconfig ipw3945d on 2>/dev/null
136
    fi
137
fi
138
 
139
### enable 915resolution on Intel Mobile Display controller
88 beyerle@PS 140
#   and set resolution in /etc/sysconfig/915resolution defined by screen=
84 beyerle@PS 141
lspci | grep -q Display.*Intel.*Mobile
142
if [ "$?" = "0" ]; then 
143
    chkconfig 915resolution on 2>/dev/null
88 beyerle@PS 144
    if [ -e /etc/sysconfig/915resolution ]; then
145
	X=$( echo $SCREEN | cut -d"x" -f1 )
146
	Y=$( echo $SCREEN | cut -d"x" -f2 )
147
	if [ $X ]; then
148
	    sed -i "s|^X=.*|X=$X|" /etc/sysconfig/915resolution
149
	fi
150
	if [ $Y ]; then
151
	    sed -i "s|^Y=.*|Y=$Y|" /etc/sysconfig/915resolution
152
	fi
153
    fi
84 beyerle@PS 154
fi
155
 
1 beyerle@PS 156
### services on
157
if [ -n $SERVICEON ]; then
158
    for service in `echo "$SERVICEON" | tr ':' ' '`; do
159
	if [ -f /etc/init.d/$service ]; then
160
	    chkconfig $service on
161
	fi
162
    done
163
fi
164
 
165
### services off
166
if [ -n $SERVICEOFF ]; then
167
    for service in `echo "$SERVICEOFF" | tr ':' ' '`; do
168
	if [ -f /etc/init.d/$service ]; then
169
	    chkconfig $service off
170
	fi
171
    done
172
fi
173
 
84 beyerle@PS 174
 
175
### -----------------------------------------------------------
176
### Main
177
### -----------------------------------------------------------
178
 
179
### get resolv.conf, if we have the LiveCD mounted over NFS
180
if [ $NFSROOT ]; then
181
    cp -f /$MOUNTDIR/live/etc/resolv.conf /etc/
182
fi
183
 
184
### restore blacklist (modified in runveryfirst)
185
if [ $NFSROOT ]; then
186
    [ -e /etc/hotplug/blacklist ] && BLACKLIST_FILE=/etc/hotplug/blacklist
187
    [ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklist
188
    mv -f ${BLACKLIST_FILE}.backup ${BLACKLIST_FILE}
189
fi
190
 
191
### create AFS mount point
192
mkdir -p /afs
193
 
194
### set afs cell, if given by boot parameter
195
if [ $CELL ]; then
196
    echo $CELL > /usr/vice/etc/ThisCell
197
fi
198
 
1 beyerle@PS 199
### fix perm of /tmp
200
chmod 1777 /tmp
201
 
202
### create home
203
mkdir -p /home
204
 
205
### create /scratch
206
mkdir -p /scratch
207
chmod 1777 /scratch
208
 
209
### create /data
210
if [ $PSI ]; then
211
    mkdir -p /data
212
    chmod 1777 /data
213
fi
214
 
215
### add PSI master
216
if [ $PSI ]; then
217
    mkdir -p /mnt/master
125 beyerle@PS 218
    echo "pxeserv01:/master       /mnt/master             nfs     noauto,nolock,ro 0 0" >> /etc/fstab
1 beyerle@PS 219
fi
220