Subversion Repositories livecd

Rev

Rev 129 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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