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