Subversion Repositories livecd

Rev

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

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