Subversion Repositories livecd

Rev

Rev 16 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 23
Line 15... Line 15...
15
#
15
#
16
# Urs Beyerle, PSI
16
# Urs Beyerle, PSI
17
#
17
#
18
###############################################################
18
###############################################################
19
 
19
 
20
# source livecd.conf
-
 
21
. livecd.conf
-
 
22
 
20
 
23
###############################################################
21
###############################################################
-
 
22
### Functions
-
 
23
###############################################################
24
 
24
 
25
function usage() {
25
function usage() {
26
 
26
 
27
   ## Usage
27
   ## Usage
28
   # ----------------------------------------------------------
28
   # ----------------------------------------------------------
29
 
29
 
30
   cat <<EOF
30
   cat <<EOF
31
 
31
 
32
  Options:
32
  Options:
33
 
33
 
34
    -h:         print this screen
34
    -h          print this screen
35
    -psi:       customize for PSI Live CD
35
    -sl4        build SL4 LiveCD/DVD
36
    -sl:        customize for SL Live CD
36
    -sl5        build SL5 LiveCD/DVD
37
 
37
 
38
  Optional Options:
38
  Optional Options:
39
 
39
 
-
 
40
    -psi        customize for PSI LiveCD
40
    -mini:      build a MINI-CD (not well tested)
41
    -mini       build a MINI-CD (not well tested)
41
    -dvd:       build a Live DVD
42
    -dvd        build a LiveDVD
42
    
43
    
43
  Additionally Options for MINI-CD:
44
  Additionally Options for MINI-CD:
44
 
45
 
45
    -nomove:    do NOT move to /mini to save diskspace 
46
    -nomove:    do NOT move to /mini to save diskspace 
46
    -rootlogin: directly login as root
47
    -rootlogin: directly login as root
Line 50... Line 51...
50
    See livecd.conf for more configuration options !!
51
    See livecd.conf for more configuration options !!
51
 
52
 
52
 
53
 
53
EOF
54
EOF
54
 
55
 
-
 
56
exit
-
 
57
 
55
}
58
}
56
 
59
 
-
 
60
###############################################################
-
 
61
### Definitions and settings
-
 
62
###############################################################
-
 
63
 
57
### read options from command-line
64
### read options from command-line
58
PSI=""
-
 
59
OPTIONS=$@
65
OPTIONS=$@
-
 
66
OS_RELEASE=""
60
 
67
 
61
while [ $# -gt 0 ]; do
68
while [ $# -gt 0 ]; do
62
 
69
 
63
    case "$1" in
70
    case "$1" in
64
       -h)
71
       -h)
65
            usage; exit;;
72
            usage; exit;;
66
       -psi)
73
       -psi)
67
            PSI="-psi"; shift; continue;;
74
            PSI="-psi"; shift; continue;;
68
       -sl)
75
       -sl4)
-
 
76
            SL="-sl"; export OS_RELEASE=4; shift; continue;;
-
 
77
       -sl5)
69
            SL="-sl"; shift; continue;;
78
            SL="-sl"; export OS_RELEASE=5; shift; continue;;
70
       -mini)
79
       -mini)
71
            MINI="-mini"; shift; continue;;
80
            MINI="-mini"; shift; continue;;
72
       -nomove)
81
       -nomove)
73
            NOMOVE="-nomove"; shift; continue;;
82
            NOMOVE="-nomove"; shift; continue;;
74
       -rootlogin)
83
       -rootlogin)
75
            ROOTLOGIN="-rootlogin"; shift; continue;;
84
            ROOTLOGIN="-rootlogin"; shift; continue;;
76
       -dvd)
85
       -dvd)
77
            DVD="-dvd"; shift; continue;;
86
            DVD="-dvd"; shift; continue;;
78
       *)
87
       *)
79
            usage; exit;;
88
            usage;;
80
    esac
89
    esac
81
 
90
 
82
done
91
done
83
 
92
 
-
 
93
 
84
### only build for SL or PSI
94
### source livecd.conf
-
 
95
. livecd.conf
-
 
96
 
85
if [ ! $PSI ] && [ ! $SL ]; then
97
### test input
86
    usage 
98
[ ! $SL ] && usage 
-
 
99
 
-
 
100
### do not run without psi option on a PSI installation
-
 
101
if [ -e /etc/sysconfig/cfengine ] && [ ! $PSI ]; then
-
 
102
    echo "I guess this is a PSI installation, please use option '-psi'"; echo
87
    exit
103
    exit
88
fi
104
fi
89
 
105
 
90
### check if I run inside my directory
106
### check if I run inside my directory
91
if [ ! -x $( basename $0 ) ]; then
107
if [ ! -x $( basename $0 ) ]; then
Line 97... Line 113...
97
BOOT_OPTIONS="$BOOT_OPTIONS $EXTRA_BOOT_OPTIONS"
113
BOOT_OPTIONS="$BOOT_OPTIONS $EXTRA_BOOT_OPTIONS"
98
 
114
 
99
### add option "psi" for PSI
115
### add option "psi" for PSI
100
[ $PSI ] && BOOT_OPTIONS="psi $BOOT_OPTIONS"
116
[ $PSI ] && BOOT_OPTIONS="psi $BOOT_OPTIONS"
101
 
117
 
-
 
118
### define ARCH
102
ARCH=$( /bin/arch )
119
ARCH=$( /bin/arch )
103
[ "$ARCH" != "x86_64" ] && ARCH=i686
120
[ "$ARCH" != "x86_64" ] && ARCH=i686
104
 
121
 
105
if [ -e /etc/redhat-release ]; then
122
### define RELEASE string
106
    RELEASE=$( cat /etc/redhat-release )
-
 
107
else
-
 
108
    RELEASE="my"
123
RELEASE="my"
109
fi
-
 
-
 
124
[ -e /etc/redhat-release ] && RELEASE=$( cat /etc/redhat-release )
110
 
125
 
111
### write my version to /etc/livecd-release
126
### write script version to /etc/livecd-release
112
my_version=$( cat version 2>/dev/null )
127
SCRIPT_VERSION=$( cat version 2>/dev/null )
113
echo $my_version > /etc/livecd-release
128
echo $SCRIPT_VERSION > /etc/livecd-release
114
 
129
 
115
### Check for SMP kernel and set SMP variable
130
### Check for SMP kernel and set SMP variable
-
 
131
#   if you change SMP="s", you have also to change isolinux.cfg!
-
 
132
#   SMP can only be one character in lenght!
116
SMP=""
133
SMP=""
117
if [ -e /boot/vmlinuz-${KERNEL}smp ]; then
134
[ -e /boot/vmlinuz-${KERNEL}smp ] && export SMP="s"
118
    # if you change SMP="s", you have also to change isolinux.cfg!
-
 
119
    # SMP can only be one character in lenght!
-
 
120
    export SMP="s"
-
 
121
fi
-
 
122
 
135
 
-
 
136
 
-
 
137
 
-
 
138
###############################################################
-
 
139
### Build LiveCD
-
 
140
###############################################################
-
 
141
 
123
### start
142
### display summary
-
 
143
### -----------------------------------------------------------
124
echo
144
 
125
echo "--------------------------------------------"
145
echo; echo "--------------------------------------------"
126
if [ $DVD ]; then 
146
if [ $DVD ]; then 
127
    echo "Build of LiveDVD started"
147
    echo "Build of LiveDVD started"
128
else
148
else
129
    echo "Build of LiveCD started"
149
    echo "Build of LiveCD started"
130
fi
150
fi
131
echo "Script version:      $my_version"
151
echo "Script version:      $SCRIPT_VERSION"
132
echo "Kernel version:      $KERNEL"
152
echo "Kernel version:      $KERNEL"
133
[ $SMP ] && echo "SMP Kernel version:  ${KERNEL}smp"
153
[ $SMP ] && echo "SMP Kernel version:  ${KERNEL}smp"
134
echo "--------------------------------------------"
154
echo "--------------------------------------------"
135
 
155
 
136
[ $PSI ]  && echo "**** Build for PSI ****"
156
[ $PSI ]  && echo "**** Build for PSI ****"
-
 
157
[ "$OS_RELEASE" = "4" ]   && echo "**** Build for SL4 ****"
137
[ $SL ]   && echo "**** Build for SL ****"
158
[ "$OS_RELEASE" = "5" ]   && echo "**** Build for SL5 ****"
138
[ $MINI ] && echo "**** Build for MINI-CD ****"
159
[ $MINI ] && echo "**** Build for MINI-CD ****"
139
echo "--------------------------------------------"
160
echo "--------------------------------------------"
140
 
161
 
141
 
162
 
-
 
163
 
142
# download livecd web page (for documentation)
164
### download livecd web page (for documentation)
-
 
165
### -----------------------------------------------------------
143
echo "Try to download latest livecd documentation"
166
echo "Try to download latest livecd documentation"
144
 
167
 
145
rm -rf /tmp/doc
168
rm -rf /tmp/doc
146
mkdir -p /tmp/doc
169
mkdir -p /tmp/doc
147
wget --timeout=3 --quiet -nH --mirror -P /tmp/doc http://linux.web.psi.ch/livecd/
170
wget --timeout=3 --quiet -nH --mirror -P /tmp/doc http://linux.web.psi.ch/livecd/
Line 151... Line 174...
151
else
174
else
152
    echo "download failed - not critical ;-)"
175
    echo "download failed - not critical ;-)"
153
fi
176
fi
154
 
177
 
155
 
178
 
-
 
179
 
156
# clean up build script directory
180
### clean up build script directory
-
 
181
### -----------------------------------------------------------
157
echo "--------------------------------------------"
182
echo "--------------------------------------------"
158
echo "Remove all *~ files in $( pwd )"
183
echo "Remove all *~ files in $( pwd )"
159
find . | grep "~$" | while read f; do rm -f "$f"; done
184
find . | grep "~$" | while read f; do rm -f "$f"; done
160
echo "done."
185
echo "done."
161
echo "--------------------------------------------"
186
echo "--------------------------------------------"
162
 
187
 
163
 
188
 
-
 
189
 
-
 
190
### Run customize-livecd.sh
-
 
191
### -----------------------------------------------------------
164
echo
192
echo
165
echo "--------------------------------------------"
193
echo "--------------------------------------------"
166
echo "Run ./customize-livecd.sh $PSI $DVD"
194
echo "Run ./customize-livecd.sh $PSI $DVD"
167
echo "--------------------------------------------"
195
echo "--------------------------------------------"
168
./customize-livecd.sh $PSI $DVD $MINI
196
./customize-livecd.sh $PSI $DVD $MINI
169
 
197
 
170
 
198
 
-
 
199
 
-
 
200
### Run mini-livecd.sh
-
 
201
### -----------------------------------------------------------
171
if [ $MINI ]; then
202
if [ $MINI ]; then
172
    echo "--------------------------------------------"
203
    echo "--------------------------------------------"
173
    echo "Run ./mini-livecd.sh $PSI $ROOTLOGIN $NOMOVE"
204
    echo "Run ./mini-livecd.sh $PSI $ROOTLOGIN $NOMOVE"
174
    echo "--------------------------------------------"
205
    echo "--------------------------------------------"
175
    ./mini-livecd.sh $PSI $ROOTLOGIN $NOMOVE
206
    ./mini-livecd.sh $PSI $ROOTLOGIN $NOMOVE
176
fi
207
fi
177
 
208
 
-
 
209
 
-
 
210
 
-
 
211
### Create /usr/share/doc/livecd
-
 
212
### -----------------------------------------------------------
178
if [ -d /tmp/doc/livecd ]; then
213
if [ -d /tmp/doc/livecd ]; then
179
    echo
214
    echo
180
    echo "--------------------------------------------"
215
    echo "--------------------------------------------"
181
    echo "Create /usr/share/doc/livecd"
216
    echo "Create /usr/share/doc/livecd"
182
    echo "--------------------------------------------"
217
    echo "--------------------------------------------"
Line 186... Line 221...
186
    cp -a /tmp/doc/livecd /usr/share/doc/
221
    cp -a /tmp/doc/livecd /usr/share/doc/
187
    echo "done."
222
    echo "done."
188
    echo
223
    echo
189
fi
224
fi
190
 
225
 
-
 
226
 
-
 
227
 
-
 
228
### Prepare files in linux-live.sl directory 
-
 
229
### -----------------------------------------------------------
191
echo
230
echo
192
echo "--------------------------------------------"
231
echo "--------------------------------------------"
193
echo "cd linux-live.sl"
232
echo "cd linux-live.sl"
194
echo "--------------------------------------------"
233
echo "--------------------------------------------"
195
 
234
 
196
cd linux-live.sl
235
cd linux-live.sl
197
 
236
 
198
echo "Set kernel boot options in cd-root/isolinux.cfg"
237
echo "Set kernel boot options in cd-root/isolinux.cfg"
-
 
238
 
199
# for lable linux
239
## for lable linux
200
sed -i "s|append l initrd=boot/initrd.gz init=linuxrc .*|append l initrd=boot/initrd.gz init=linuxrc $BOOT_OPTIONS|" cd-root/isolinux.cfg
240
sed -i "s|append l initrd=boot/initrd.gz init=linuxrc .*|append l initrd=boot/initrd.gz init=linuxrc $BOOT_OPTIONS|" cd-root/isolinux.cfg
-
 
241
 
201
# for lable linuxsmp
242
## for lable linuxsmp
202
sed -i "s|append l initrd=boot/initrd${SMP}.gz init=linuxrc .*|append l initrd=boot/initrd${SMP}.gz init=linuxrc $BOOT_OPTIONS|" cd-root/isolinux.cfg
243
sed -i "s|append l initrd=boot/initrd${SMP}.gz init=linuxrc .*|append l initrd=boot/initrd${SMP}.gz init=linuxrc $BOOT_OPTIONS|" cd-root/isolinux.cfg
-
 
244
 
203
# for lable failsafe
245
## for lable failsafe
204
sed -i "s|append f initrd=boot/initrd.gz init=linuxrc .*|append f initrd=boot/initrd.gz init=linuxrc $BOOT_OPTIONS $FAILSAFE_BOOT_OPTIONS|" cd-root/isolinux.cfg
246
sed -i "s|append f initrd=boot/initrd.gz init=linuxrc .*|append f initrd=boot/initrd.gz init=linuxrc $BOOT_OPTIONS $FAILSAFE_BOOT_OPTIONS|" cd-root/isolinux.cfg
205
 
247
 
-
 
248
## Set Welcome ...
206
echo "Set 'Welcome ... to' in splash.cfg"
249
echo "Set 'Welcome ... to' in splash.cfg"
207
sed -i "s|DVD|CD|" cd-root/boot/splash.cfg
250
sed -i "s|DVD|CD|" cd-root/boot/splash.cfg
208
 
-
 
209
if [ $PSI ]; then
251
if [ $PSI ]; then
210
    sed -i "s|Welcome to.*|Welcome to PSI $LIVECD_OS LiveCD|" cd-root/boot/splash.cfg
252
    sed -i "s|Welcome to.*|Welcome to PSI $LIVECD_OS LiveCD|" cd-root/boot/splash.cfg
211
else
253
else
212
    sed -i "s|Welcome to.*|Welcome to $RELEASE|" cd-root/boot/splash.cfg
254
    sed -i "s|Welcome to.*|Welcome to $RELEASE|" cd-root/boot/splash.cfg
213
fi
255
fi
214
 
256
 
-
 
257
## Set LiveCD / LiveCD 64bit
215
sed -i "s|LiveCD 64bit|LiveCD|" cd-root/boot/splash.cfg
258
sed -i "s|LiveCD 64bit|LiveCD|" cd-root/boot/splash.cfg
216
if [ "$ARCH" = "x86_64" ]; then
-
 
217
    sed -i "s|LiveCD|LiveCD 64bit|" cd-root/boot/splash.cfg
259
[ "$ARCH" = "x86_64" ] && sed -i "s|LiveCD|LiveCD 64bit|" cd-root/boot/splash.cfg
218
fi
-
 
219
 
260
 
220
if [ $DVD ]; then
261
## Set DVD or CD
221
    sed -i "s|CD|DVD|" cd-root/boot/splash.cfg
262
[ $DVD ] && sed -i "s|CD|DVD|" cd-root/boot/splash.cfg
222
fi
-
 
223
 
-
 
224
echo "Set KERNEL=$KERNEL in config"
-
 
225
sed -i "s|^KERNEL=.*|KERNEL=$KERNEL|" config
-
 
226
 
263
 
227
echo "Set RAM0SIZE=$RAM0SIZE in config"
-
 
228
sed -i "s|^RAM0SIZE=.*|RAM0SIZE=$RAM0SIZE|" config
-
 
229
 
264
 
230
# echo "Set ramdisk_size=$RAMDISK_SIZE in cd-root/boot/DOS/config"
-
 
231
# sed -i "s|^ramdisk_size=.*|ramdisk_size=$RAMDISK_SIZE|" cd-root/boot/DOS/config
-
 
232
 
265
 
-
 
266
### Run runme.sh
-
 
267
### -----------------------------------------------------------
233
echo
268
echo
234
echo "--------------------------------------------"
269
echo "--------------------------------------------"
235
echo "Run ./runme.sh"
270
echo "Run ./runme.sh"
236
echo "--------------------------------------------"
271
echo "--------------------------------------------"
237
./runme.sh
272
./runme.sh
238
 
273
 
-
 
274
 
-
 
275
 
-
 
276
### Run restore-system.sh
-
 
277
### -----------------------------------------------------------
239
echo
278
echo
240
echo "--------------------------------------------"
279
echo "--------------------------------------------"
241
echo "Now fix things to make this system bootable"
280
echo "Now fix things to make this system bootable"
242
echo "--------------------------------------------"
281
echo "--------------------------------------------"
243
cd ..
282
cd ..
244
./restore-system.sh $PSI
283
./restore-system.sh $PSI
245
 
284
 
246
 
285
 
-
 
286
 
-
 
287
### End of LiveCD build
-
 
288
### -----------------------------------------------------------
247
echo "--------------------------------------------"
289
echo "--------------------------------------------"
248
echo "End of Build LiveCD" 
290
echo "End of Build LiveCD" 
249
echo "See /tmp for the ISO image"
291
echo "See /tmp for the ISO image"
250
echo "--------------------------------------------"
292
echo "--------------------------------------------"