Subversion Repositories livecd

Rev

Rev 131 | 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
 
131 beyerle@PS 51
# no (auto) kudzu ?
52
NOKUDZU=$( cmdline_parameter nokudzu )
53
 
1 beyerle@PS 54
# if run=rdesktop, we do fast boot
55
if [ "$( cmdline_value run )" = "rdesktop" ]; then
56
    FASTBOOT="fastboot"
57
fi
137 beyerle@PS 58
 
1 beyerle@PS 59
# start ntpd ?
60
NTPD=$( cmdline_parameter ntpd )
61
 
62
# services on/off
63
SERVICEON=$( cmdline_value serviceon )
64
SERVICEOFF=$( cmdline_value serviceoff )
65
 
88 beyerle@PS 66
# Xserver configurations
67
SCREEN=$( cmdline_value screen )
1 beyerle@PS 68
 
88 beyerle@PS 69
 
1 beyerle@PS 70
### -----------------------------------------------------------
84 beyerle@PS 71
### Configure services
1 beyerle@PS 72
### -----------------------------------------------------------
73
 
137 beyerle@PS 74
### save status of services that may be disabled, if LiveCD mounted over NFS
75
if [ $NFSROOT ]; then
76
    NFS_SERVICES="rpcidmapd NetworkManager NetworkManagerDispatcher \
77
                  netfs nfslock portmap network"
78
    for serv in $NFS_SERVICES; do
79
	chkconfig --list $serv | grep -q ":on" && echo $serv >> /$MOUNTDIR/service.on
80
    done
81
fi
82
 
1 beyerle@PS 83
### disable rpcidmapd, if LiveCD mounted over NFS
84
if [ $NFSROOT ]; then
137 beyerle@PS 85
    $MOUNTDIR
105 beyerle@PS 86
    chkconfig rpcidmapd off >/dev/null 2>&1
1 beyerle@PS 87
fi
88
 
88 beyerle@PS 89
### disable NetworkManager, if LiveCD mounted over NFS
90
if [ $NFSROOT ]; then
105 beyerle@PS 91
    chkconfig NetworkManager off           >/dev/null 2>&1
92
    chkconfig NetworkManagerDispatcher off >/dev/null 2>&1 
88 beyerle@PS 93
fi
94
 
1 beyerle@PS 95
### disable shutdown of network and nfs, 
96
# if we have the LiveCD mounted over NFS
97
if [ $NFSROOT ]; then
98
    if [ $ONEMASTER ]; then
99
        # "network off" is only necessary, 
100
        # if PXE/TFTP and NTS server is on same machine
101
	chkconfig network off
102
    fi
103
 
128 beyerle@PS 104
    rm -f /etc/rc.d/rc6.d/K*netfs
105
    rm -f /etc/rc.d/rc6.d/K*nfslock
106
    rm -f /etc/rc.d/rc6.d/K*portmap
107
    rm -f /etc/rc.d/rc6.d/K*network
1 beyerle@PS 108
 
128 beyerle@PS 109
    rm -f /etc/rc.d/rc0.d/K*netfs
110
    rm -f /etc/rc.d/rc0.d/K*nfslock
111
    rm -f /etc/rc.d/rc0.d/K*portmap
112
    rm -f /etc/rc.d/rc0.d/K*network
1 beyerle@PS 113
fi
114
 
115
### enable AFS during start up, if given by boot parameter
116
if [ $AFS ]; then
117
    chkconfig afs on
118
fi
119
 
131 beyerle@PS 120
### disable auto-kudzu
121
if [ $NOKUDZU ]; then
122
    chkconfig kudzu-auto off
123
fi
124
 
1 beyerle@PS 125
### disable some services for fast booting
126
if [ $FASTBOOT ]; then    
127
    echo "Fast booting enabled"
128 beyerle@PS 128
    chkconfig vpnclient_init off  2>/dev/null
129
    chkconfig haldaemon off       2>/dev/null
130
    chkconfig pcmcia off          2>/dev/null
131
    chkconfig ntpd off            2>/dev/null
132
    chkconfig atd off             2>/dev/null
133
    chkconfig cpuspeed off        2>/dev/null
134
    chkconfig gpm off             2>/dev/null
135
    chkconfig messagebus off      2>/dev/null
129 beyerle@PS 136
    chkconfig avahi-daemon off    2>/dev/null
128 beyerle@PS 137
    chkconfig kudzu-auto off      2>/dev/null
1 beyerle@PS 138
fi
139
 
140
### enable ntpd?
141
if [ $NTPD ]; then
142
    chkconfig ntpd on
143
fi
144
 
145
### enable SSH server during start up, if given by boot parameter
146
if [ $SSH ]; then
147
    chkconfig sshd on
148
fi
149
 
84 beyerle@PS 150
### activate ipw3945d daemon, if we have Intel IPW3945 WLAN 
151
if [ ! $NONET ]; then
152
    lspci | grep -q Intel.*3945ABG
153
    if [ "$?" = "0" ]; then
154
	chkconfig ipw3945d on 2>/dev/null
155
    fi
156
fi
157
 
158
### enable 915resolution on Intel Mobile Display controller
88 beyerle@PS 159
#   and set resolution in /etc/sysconfig/915resolution defined by screen=
84 beyerle@PS 160
lspci | grep -q Display.*Intel.*Mobile
161
if [ "$?" = "0" ]; then 
162
    chkconfig 915resolution on 2>/dev/null
88 beyerle@PS 163
    if [ -e /etc/sysconfig/915resolution ]; then
164
	X=$( echo $SCREEN | cut -d"x" -f1 )
165
	Y=$( echo $SCREEN | cut -d"x" -f2 )
166
	if [ $X ]; then
167
	    sed -i "s|^X=.*|X=$X|" /etc/sysconfig/915resolution
168
	fi
169
	if [ $Y ]; then
170
	    sed -i "s|^Y=.*|Y=$Y|" /etc/sysconfig/915resolution
171
	fi
172
    fi
84 beyerle@PS 173
fi
174
 
1 beyerle@PS 175
### services on
176
if [ -n $SERVICEON ]; then
177
    for service in `echo "$SERVICEON" | tr ':' ' '`; do
178
	if [ -f /etc/init.d/$service ]; then
179
	    chkconfig $service on
180
	fi
181
    done
182
fi
183
 
184
### services off
185
if [ -n $SERVICEOFF ]; then
186
    for service in `echo "$SERVICEOFF" | tr ':' ' '`; do
187
	if [ -f /etc/init.d/$service ]; then
188
	    chkconfig $service off
189
	fi
190
    done
191
fi
192
 
84 beyerle@PS 193
 
194
### -----------------------------------------------------------
195
### Main
196
### -----------------------------------------------------------
197
 
198
### get resolv.conf, if we have the LiveCD mounted over NFS
199
if [ $NFSROOT ]; then
200
    cp -f /$MOUNTDIR/live/etc/resolv.conf /etc/
201
fi
202
 
203
### restore blacklist (modified in runveryfirst)
204
if [ $NFSROOT ]; then
205
    [ -e /etc/hotplug/blacklist ] && BLACKLIST_FILE=/etc/hotplug/blacklist
206
    [ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklist
207
    mv -f ${BLACKLIST_FILE}.backup ${BLACKLIST_FILE}
208
fi
209
 
210
### create AFS mount point
211
mkdir -p /afs
212
 
213
### set afs cell, if given by boot parameter
214
if [ $CELL ]; then
215
    echo $CELL > /usr/vice/etc/ThisCell
216
fi
217
 
1 beyerle@PS 218
### fix perm of /tmp
219
chmod 1777 /tmp
220
 
221
### create home
222
mkdir -p /home
223
 
224
### create /scratch
225
mkdir -p /scratch
226
chmod 1777 /scratch
227
 
228
### create /data
229
if [ $PSI ]; then
230
    mkdir -p /data
231
    chmod 1777 /data
232
fi
233
 
234
### add PSI master
235
if [ $PSI ]; then
236
    mkdir -p /mnt/master
125 beyerle@PS 237
    echo "pxeserv01:/master       /mnt/master             nfs     noauto,nolock,ro 0 0" >> /etc/fstab
1 beyerle@PS 238
fi
239