Subversion Repositories livecd

Rev

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