Subversion Repositories livecd

Rev

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