Subversion Repositories livecd

Rev

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

Rev 73 Rev 84
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
# Executed at the very end of /etc/rc.d/rc.sysinit
5
# Executed at the very end of /etc/rc.d/rc.sysinit
5
#
6
#
6
# Urs Beyerle, PSI
7
# Urs Beyerle, PSI
7
#
8
#
8
 
9
 
9
### -----------------------------------------------------------
10
### -----------------------------------------------------------
10
### definitions
11
### Definitions
11
### -----------------------------------------------------------
12
### -----------------------------------------------------------
12
 
13
 
13
# dir of mounted /$MOUNTDIR/live
14
# dir of mounted /$MOUNTDIR/live
14
MOUNTDIR=livecd
15
MOUNTDIR=livecd
15
 
16
 
16
# source functions
17
# source functions
17
. /$MOUNTDIR/live/liblinuxlive
18
. /$MOUNTDIR/live/liblinuxlive
18
. /etc/init.d/functions
19
. /etc/init.d/functions
19
 
20
 
20
 
21
 
21
### -----------------------------------------------------------
22
### -----------------------------------------------------------
22
### Get boot parameters
23
### Get boot parameters
23
### -----------------------------------------------------------
24
### -----------------------------------------------------------
24
 
25
 
25
# start afs?
26
# start afs?
26
AFS=$( cmdline_parameter afs )
27
AFS=$( cmdline_parameter afs )
27
CELL=$( cmdline_value cell )
28
CELL=$( cmdline_value cell )
28
 
29
 
29
# or force no afs
30
# or force no afs
30
[ $( cmdline_parameter noafs ) ] && AFS=""
31
[ $( cmdline_parameter noafs ) ] && AFS=""
31
 
32
 
32
# start ssh server?
33
# start ssh server?
33
SSH=$( cmdline_parameter ssh )
34
SSH=$( cmdline_parameter ssh )
34
 
35
 
35
# root on NFS?
36
# root on NFS?
36
NFSROOT=$( cmdline_value nfsroot )
37
NFSROOT=$( cmdline_value nfsroot )
37
 
38
 
38
# PSI setup?
39
# PSI setup?
39
PSI=$( cmdline_parameter psi )
40
PSI=$( cmdline_parameter psi )
40
 
41
 
41
# do not start network
42
# do not start network
42
NONET=$( cmdline_parameter nonet )
43
NONET=$( cmdline_parameter nonet )
43
 
44
 
44
# 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
45
ONEMASTER=$( cmdline_parameter onemaster )
46
ONEMASTER=$( cmdline_parameter onemaster )
46
 
47
 
47
# fast booting ?
48
# fast booting ?
48
FASTBOOT=$( cmdline_parameter fastboot )
49
FASTBOOT=$( cmdline_parameter fastboot )
49
 
50
 
50
# if run=rdesktop, we do fast boot
51
# if run=rdesktop, we do fast boot
51
if [ "$( cmdline_value run )" = "rdesktop" ]; then
52
if [ "$( cmdline_value run )" = "rdesktop" ]; then
52
    FASTBOOT="fastboot"
53
    FASTBOOT="fastboot"
53
fi
54
fi
54
 
55
 
55
# start ntpd ?
56
# start ntpd ?
56
NTPD=$( cmdline_parameter ntpd )
57
NTPD=$( cmdline_parameter ntpd )
57
 
58
 
58
# services on/off
59
# services on/off
59
SERVICEON=$( cmdline_value serviceon )
60
SERVICEON=$( cmdline_value serviceon )
60
SERVICEOFF=$( cmdline_value serviceoff )
61
SERVICEOFF=$( cmdline_value serviceoff )
61
 
62
 
62
 
63
 
63
### -----------------------------------------------------------
64
### -----------------------------------------------------------
64
### Main
65
### Configure services
65
### -----------------------------------------------------------
66
### -----------------------------------------------------------
66
 
67
 
67
### disable rpcidmapd, if LiveCD mounted over NFS
68
### disable rpcidmapd, if LiveCD mounted over NFS
68
if [ $NFSROOT ]; then
69
if [ $NFSROOT ]; then
69
    chkconfig rpcidmapd off
70
    chkconfig rpcidmapd off
70
fi
71
fi
71
 
72
 
72
### restore blacklist (modified in runveryfirst)
-
 
73
if [ $NFSROOT ]; then
-
 
74
    [ -e /etc/hotplug/blacklist ] && BLACKLIST_FILE=/etc/hotplug/blacklist
-
 
75
    [ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklist
-
 
76
    mv -f ${BLACKLIST_FILE}.backup ${BLACKLIST_FILE}
-
 
77
fi
-
 
78
 
-
 
79
### get resolv.conf
-
 
80
# if we have the LiveCD mounted over NFS
-
 
81
if [ $NFSROOT ]; then
-
 
82
    cp -f /$MOUNTDIR/live/etc/resolv.conf /etc/
-
 
83
fi
-
 
84
 
-
 
85
### disable shutdown of network and nfs, 
73
### disable shutdown of network and nfs, 
86
# if we have the LiveCD mounted over NFS
74
# if we have the LiveCD mounted over NFS
87
if [ $NFSROOT ]; then
75
if [ $NFSROOT ]; then
88
    if [ $ONEMASTER ]; then
76
    if [ $ONEMASTER ]; then
89
        # "network off" is only necessary, 
77
        # "network off" is only necessary, 
90
        # if PXE/TFTP and NTS server is on same machine
78
        # if PXE/TFTP and NTS server is on same machine
91
	chkconfig network off
79
	chkconfig network off
92
    fi
80
    fi
93
 
81
 
94
    rm -f /etc/rc.d/rc6.d/K75netfs
82
    rm -f /etc/rc.d/rc6.d/K75netfs
95
    rm -f /etc/rc.d/rc6.d/K86nfslock
83
    rm -f /etc/rc.d/rc6.d/K86nfslock
96
    rm -f /etc/rc.d/rc6.d/K87portmap
84
    rm -f /etc/rc.d/rc6.d/K87portmap
97
    rm -f /etc/rc.d/rc6.d/K90network
85
    rm -f /etc/rc.d/rc6.d/K90network
98
 
86
 
99
    rm -f /etc/rc.d/rc0.d/K75netfs
87
    rm -f /etc/rc.d/rc0.d/K75netfs
100
    rm -f /etc/rc.d/rc0.d/K86nfslock
88
    rm -f /etc/rc.d/rc0.d/K86nfslock
101
    rm -f /etc/rc.d/rc0.d/K87portmap
89
    rm -f /etc/rc.d/rc0.d/K87portmap
102
    rm -f /etc/rc.d/rc0.d/K90network
90
    rm -f /etc/rc.d/rc0.d/K90network
103
fi
91
fi
104
 
92
 
105
### create AFS mount point
-
 
106
mkdir -p /afs
-
 
107
 
-
 
108
### enable AFS during start up, if given by boot parameter
93
### enable AFS during start up, if given by boot parameter
109
if [ $AFS ]; then
94
if [ $AFS ]; then
110
    chkconfig afs on
95
    chkconfig afs on
111
fi
96
fi
112
 
97
 
113
### disable some services for fast booting
98
### disable some services for fast booting
114
if [ $FASTBOOT ]; then    
99
if [ $FASTBOOT ]; then    
115
    echo "Fast booting enabled"
100
    echo "Fast booting enabled"
116
    chkconfig vpnclient_init off
101
    chkconfig vpnclient_init off
117
    chkconfig haldaemon off
102
    chkconfig haldaemon off
118
    chkconfig pcmcia off
103
    chkconfig pcmcia off
119
    chkconfig ntpd off
104
    chkconfig ntpd off
120
    chkconfig atd off
105
    chkconfig atd off
121
    chkconfig cpuspeed off
106
    chkconfig cpuspeed off
122
    chkconfig gpm off
107
    chkconfig gpm off
123
    chkconfig messagebus off
108
    chkconfig messagebus off
124
    rm -rf /etc/rc.d/rc3.d/S04kudzu-auto
109
    rm -rf /etc/rc.d/rc3.d/S04kudzu-auto
125
    rm -rf /etc/rc.d/rc5.d/S04kudzu-auto
110
    rm -rf /etc/rc.d/rc5.d/S04kudzu-auto
126
fi
111
fi
127
 
112
 
128
### enable ntpd?
113
### enable ntpd?
129
if [ $NTPD ]; then
114
if [ $NTPD ]; then
130
    chkconfig ntpd on
115
    chkconfig ntpd on
131
fi
116
fi
132
 
117
 
133
### enable SSH server during start up, if given by boot parameter
118
### enable SSH server during start up, if given by boot parameter
134
if [ $SSH ]; then
119
if [ $SSH ]; then
135
    chkconfig sshd on
120
    chkconfig sshd on
136
fi
121
fi
137
 
122
 
-
 
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
 
138
### services on
137
### services on
139
if [ -n $SERVICEON ]; then
138
if [ -n $SERVICEON ]; then
140
    for service in `echo "$SERVICEON" | tr ':' ' '`; do
139
    for service in `echo "$SERVICEON" | tr ':' ' '`; do
141
	if [ -f /etc/init.d/$service ]; then
140
	if [ -f /etc/init.d/$service ]; then
142
	    chkconfig $service on
141
	    chkconfig $service on
143
	fi
142
	fi
144
    done
143
    done
145
fi
144
fi
146
 
145
 
147
### services off
146
### services off
148
if [ -n $SERVICEOFF ]; then
147
if [ -n $SERVICEOFF ]; then
149
    for service in `echo "$SERVICEOFF" | tr ':' ' '`; do
148
    for service in `echo "$SERVICEOFF" | tr ':' ' '`; do
150
	if [ -f /etc/init.d/$service ]; then
149
	if [ -f /etc/init.d/$service ]; then
151
	    chkconfig $service off
150
	    chkconfig $service off
152
	fi
151
	fi
153
    done
152
    done
154
fi
153
fi
155
 
154
 
-
 
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
 
156
### fix perm of /tmp
180
### fix perm of /tmp
157
chmod 1777 /tmp
181
chmod 1777 /tmp
158
 
182
 
159
### link /opt -> /usr/opt !
183
### link /opt -> /usr/opt !
160
ln -s /usr/opt /opt
184
ln -s /usr/opt /opt
161
 
185
 
162
### create home
186
### create home
163
mkdir -p /home
187
mkdir -p /home
164
 
188
 
165
### create /scratch
189
### create /scratch
166
mkdir -p /scratch
190
mkdir -p /scratch
167
chmod 1777 /scratch
191
chmod 1777 /scratch
168
 
192
 
169
### create /data
193
### create /data
170
if [ $PSI ]; then
194
if [ $PSI ]; then
171
    mkdir -p /data
195
    mkdir -p /data
172
    chmod 1777 /data
196
    chmod 1777 /data
173
fi
197
fi
174
 
198
 
175
### add PSI master
199
### add PSI master
176
if [ $PSI ]; then
200
if [ $PSI ]; then
177
    mkdir -p /mnt/master
201
    mkdir -p /mnt/master
178
    echo "pxeserv01:/master       /mnt/master             nfs     nfsvers=2,noauto,nolock,ro 0 0" >> /etc/fstab
202
    echo "pxeserv01:/master       /mnt/master             nfs     nfsvers=2,noauto,nolock,ro 0 0" >> /etc/fstab
179
fi
203
fi
180
 
-
 
181
### set afs cell, if given by boot parameter
-
 
182
if [ $CELL ]; then
-
 
183
    echo $CELL > /usr/vice/etc/ThisCell
-
 
184
fi
-
 
185
 
204