Subversion Repositories livecd

Rev

Rev 73 | 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
 
63
 
64
### -----------------------------------------------------------
84 beyerle@PS 65
### Configure services
1 beyerle@PS 66
### -----------------------------------------------------------
67
 
68
### disable rpcidmapd, if LiveCD mounted over NFS
69
if [ $NFSROOT ]; then
70
    chkconfig rpcidmapd off
71
fi
72
 
73
### disable shutdown of network and nfs, 
74
# if we have the LiveCD mounted over NFS
75
if [ $NFSROOT ]; then
76
    if [ $ONEMASTER ]; then
77
        # "network off" is only necessary, 
78
        # if PXE/TFTP and NTS server is on same machine
79
	chkconfig network off
80
    fi
81
 
82
    rm -f /etc/rc.d/rc6.d/K75netfs
83
    rm -f /etc/rc.d/rc6.d/K86nfslock
84
    rm -f /etc/rc.d/rc6.d/K87portmap
85
    rm -f /etc/rc.d/rc6.d/K90network
86
 
87
    rm -f /etc/rc.d/rc0.d/K75netfs
88
    rm -f /etc/rc.d/rc0.d/K86nfslock
89
    rm -f /etc/rc.d/rc0.d/K87portmap
90
    rm -f /etc/rc.d/rc0.d/K90network
91
fi
92
 
93
### enable AFS during start up, if given by boot parameter
94
if [ $AFS ]; then
95
    chkconfig afs on
96
fi
97
 
98
### disable some services for fast booting
99
if [ $FASTBOOT ]; then    
100
    echo "Fast booting enabled"
101
    chkconfig vpnclient_init off
102
    chkconfig haldaemon off
103
    chkconfig pcmcia off
104
    chkconfig ntpd off
105
    chkconfig atd off
106
    chkconfig cpuspeed off
107
    chkconfig gpm off
108
    chkconfig messagebus off
109
    rm -rf /etc/rc.d/rc3.d/S04kudzu-auto
110
    rm -rf /etc/rc.d/rc5.d/S04kudzu-auto
111
fi
112
 
113
### enable ntpd?
114
if [ $NTPD ]; then
115
    chkconfig ntpd on
116
fi
117
 
118
### enable SSH server during start up, if given by boot parameter
119
if [ $SSH ]; then
120
    chkconfig sshd on
121
fi
122
 
84 beyerle@PS 123
### activate ipw3945d daemon, if we have Intel IPW3945 WLAN 
124
if [ ! $NONET ]; then
125
    lspci | grep -q Intel.*3945ABG
126
    if [ "$?" = "0" ]; then
127
	chkconfig ipw3945d on 2>/dev/null
128
    fi
129
fi
130
 
131
### enable 915resolution on Intel Mobile Display controller
132
lspci | grep -q Display.*Intel.*Mobile
133
if [ "$?" = "0" ]; then 
134
    chkconfig 915resolution on 2>/dev/null
135
fi
136
 
1 beyerle@PS 137
### services on
138
if [ -n $SERVICEON ]; then
139
    for service in `echo "$SERVICEON" | tr ':' ' '`; do
140
	if [ -f /etc/init.d/$service ]; then
141
	    chkconfig $service on
142
	fi
143
    done
144
fi
145
 
146
### services off
147
if [ -n $SERVICEOFF ]; then
148
    for service in `echo "$SERVICEOFF" | tr ':' ' '`; do
149
	if [ -f /etc/init.d/$service ]; then
150
	    chkconfig $service off
151
	fi
152
    done
153
fi
154
 
84 beyerle@PS 155
 
156
### -----------------------------------------------------------
157
### Main
158
### -----------------------------------------------------------
159
 
160
### get resolv.conf, if we have the LiveCD mounted over NFS
161
if [ $NFSROOT ]; then
162
    cp -f /$MOUNTDIR/live/etc/resolv.conf /etc/
163
fi
164
 
165
### restore blacklist (modified in runveryfirst)
166
if [ $NFSROOT ]; then
167
    [ -e /etc/hotplug/blacklist ] && BLACKLIST_FILE=/etc/hotplug/blacklist
168
    [ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklist
169
    mv -f ${BLACKLIST_FILE}.backup ${BLACKLIST_FILE}
170
fi
171
 
172
### create AFS mount point
173
mkdir -p /afs
174
 
175
### set afs cell, if given by boot parameter
176
if [ $CELL ]; then
177
    echo $CELL > /usr/vice/etc/ThisCell
178
fi
179
 
1 beyerle@PS 180
### fix perm of /tmp
181
chmod 1777 /tmp
182
 
183
### link /opt -> /usr/opt !
184
ln -s /usr/opt /opt
185
 
186
### create home
187
mkdir -p /home
188
 
189
### create /scratch
190
mkdir -p /scratch
191
chmod 1777 /scratch
192
 
193
### create /data
194
if [ $PSI ]; then
195
    mkdir -p /data
196
    chmod 1777 /data
197
fi
198
 
199
### add PSI master
200
if [ $PSI ]; then
201
    mkdir -p /mnt/master
202
    echo "pxeserv01:/master       /mnt/master             nfs     nfsvers=2,noauto,nolock,ro 0 0" >> /etc/fstab
203
fi
204