Subversion Repositories livecd

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 beyerle@PS 1
#!/bin/bash
2
#
3
###############################################################
4
#
5
# This will build the CD iso image in /tmp
6
# 
7
# it will execute:
8
# - ./customize-livecd.sh
9
# - ./runme.sh
10
# - ./restore-system.sh
11
#
12
# will take the configuration from
13
# - ./livecd.conf
14
#
15
# Urs Beyerle, PSI
16
#
17
###############################################################
18
 
19
# source livecd.conf
20
. livecd.conf
21
 
22
###############################################################
23
 
24
function usage() {
25
 
26
   ## Usage
27
   # ----------------------------------------------------------
28
 
29
   cat <<EOF
30
 
9 beyerle@PS 31
   Options:
1 beyerle@PS 32
 
33
    -h:         print this screen
34
    -psi:       customize for PSI Live CD
35
    -sl:        customize for SL Live CD
36
 
9 beyerle@PS 37
   Optional Options:
1 beyerle@PS 38
 
9 beyerle@PS 39
    -mini:      build a MINI-CD ROM
1 beyerle@PS 40
    -dvd:       build a Live DVD
41
 
9 beyerle@PS 42
    Additionally Options for MINI-CD:
1 beyerle@PS 43
 
44
    -nomove:    do NOT move to /mini to save diskspace 
45
    -rootlogin: directly login as root
46
 
47
 
48
EOF
49
 
50
}
51
 
52
### read options from command-line
53
PSI=""
54
OPTIONS=$@
55
 
56
while [ $# -gt 0 ]; do
57
 
58
    case "$1" in
59
       -h)
60
            usage; exit;;
61
       -psi)
62
            PSI="-psi"; shift; continue;;
63
       -sl)
64
            SL="-sl"; shift; continue;;
65
       -mini)
66
            MINI="-mini"; shift; continue;;
67
       -nomove)
68
            NOMOVE="-nomove"; shift; continue;;
69
       -rootlogin)
70
            ROOTLOGIN="-rootlogin"; shift; continue;;
71
       -dvd)
72
            DVD="-dvd"; shift; continue;;
73
       *)
74
            usage; exit;;
75
    esac
76
 
77
done
78
 
79
### only build for SL or PSI
80
if [ ! $PSI ] && [ ! $SL ]; then
81
    usage 
82
    exit
83
fi
84
 
85
### check if I run inside my directory
86
if [ ! -x $( basename $0 ) ]; then
87
    echo "Please run $( basename $0 ) within its directory"
88
    exit 1
89
fi
90
 
91
### add extra boot options
92
BOOT_OPTIONS="$BOOT_OPTIONS $EXTRA_BOOT_OPTIONS"
93
 
94
### add option "psi" for PSI
95
[ $PSI ] && BOOT_OPTIONS="psi $BOOT_OPTIONS"
96
 
97
ARCH=$( /bin/arch )
98
[ "$ARCH" != "x86_64" ] && ARCH=i686
99
 
100
if [ -e /etc/redhat-release ]; then
101
    RELEASE=$( cat /etc/redhat-release )
102
else
103
    RELEASE="my"
104
fi
105
 
106
### write my version to /etc/livecd-release
9 beyerle@PS 107
my_pwd=$( pwd )
108
my_version=${my_pwd##*/}
1 beyerle@PS 109
echo $my_version > /etc/livecd-release
110
 
111
### Check for SMP kernel and set SMP variable
112
SMP=""
113
if [ -e /boot/vmlinuz-${KERNEL}smp ]; then
114
    # if you change SMP="s", you have also to change isolinux.cfg!
115
    # SMP can only be one character in lenght!
116
    export SMP="s"
117
fi
118
 
119
### start
120
echo
121
echo "--------------------------------------------"
122
if [ $DVD ]; then 
123
    echo "Build of LiveDVD started"
124
else
125
    echo "Build of LiveCD started"
126
fi
127
echo "Script version:      $my_version"
128
echo "Kernel version:      $KERNEL"
129
[ $SMP ] && echo "SMP Kernel version:  ${KERNEL}smp"
130
echo "--------------------------------------------"
131
 
132
[ $PSI ]  && echo "**** Build for PSI ****"
133
[ $SL ]   && echo "**** Build for SL ****"
134
[ $MINI ] && echo "**** Build for MINI-CD ****"
135
echo "--------------------------------------------"
136
 
137
 
138
# download livecd web page (for documentation)
139
echo "Try to download latest livecd documentation"
140
 
141
rm -rf /tmp/doc
142
mkdir -p /tmp/doc
143
wget --timeout=3 --quiet -nH --mirror -P /tmp/doc http://linux.web.psi.ch/livecd/
144
wget --timeout=3 --quiet -nH --mirror -P /tmp/doc http://linux.web.psi.ch/livecd/layout.css
145
if [ -d /tmp/doc/livecd ]; then
146
    echo "done."
147
else
148
    echo "download failed - not critical ;-)"
149
fi
150
 
151
 
152
# clean up build script directory
153
echo "--------------------------------------------"
154
echo "Remove all *~ files in $( pwd )"
155
find . | grep "~$" | while read f; do rm -f "$f"; done
156
echo "done."
157
echo "--------------------------------------------"
158
 
159
 
160
echo
161
echo "--------------------------------------------"
162
echo "Run ./customize-livecd.sh $PSI $DVD"
163
echo "--------------------------------------------"
164
./customize-livecd.sh $PSI $DVD $MINI
165
 
166
 
167
if [ $MINI ]; then
168
    echo "--------------------------------------------"
169
    echo "Run ./mini-livecd.sh $PSI $ROOTLOGIN $NOMOVE"
170
    echo "--------------------------------------------"
171
    ./mini-livecd.sh $PSI $ROOTLOGIN $NOMOVE
172
fi
173
 
174
if [ -d /tmp/doc/livecd ]; then
175
    echo
176
    echo "--------------------------------------------"
177
    echo "Create /usr/share/doc/livecd"
178
    echo "--------------------------------------------"
179
    mkdir -p /usr/share/doc/HTML
180
    cp -a customize/HTML/index.html /usr/share/doc/HTML/index.html    
181
    rm -rf /usr/share/doc/livecd
182
    cp -a /tmp/doc/livecd /usr/share/doc/
183
    echo "done."
184
    echo
185
fi
186
 
187
echo
188
echo "--------------------------------------------"
9 beyerle@PS 189
echo "cd linux-live.sl4"
1 beyerle@PS 190
echo "--------------------------------------------"
191
 
9 beyerle@PS 192
cd linux-live.sl4
1 beyerle@PS 193
 
194
echo "Set kernel boot options in cd-root/isolinux.cfg"
195
# for lable linux
196
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
197
# for lable linuxsmp
198
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
199
# for lable failsafe
200
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
201
 
202
echo "Set 'Welcome ... to' in splash.cfg"
203
sed -i "s|DVD|CD|" cd-root/boot/splash.cfg
204
 
205
if [ $PSI ]; then
9 beyerle@PS 206
    sed -i "s|Welcome to.* LiveCD.*|Welcome to PSI SL4 LiveCD|" cd-root/boot/splash.cfg
1 beyerle@PS 207
else
208
    sed -i "s|Welcome to.* LiveCD.*|Welcome to $RELEASE|" cd-root/boot/splash.cfg
209
fi
210
 
211
sed -i "s|LiveCD 64bit|LiveCD|" cd-root/boot/splash.cfg
212
if [ "$ARCH" = "x86_64" ]; then
213
    sed -i "s|LiveCD|LiveCD 64bit|" cd-root/boot/splash.cfg
214
fi
215
 
216
if [ $DVD ]; then
217
    sed -i "s|CD|DVD|" cd-root/boot/splash.cfg
218
fi
219
 
220
echo "Set KERNEL=$KERNEL in config"
221
sed -i "s|^KERNEL=.*|KERNEL=$KERNEL|" config
222
 
223
echo "Set RAM0SIZE=$RAM0SIZE in config"
224
sed -i "s|^RAM0SIZE=.*|RAM0SIZE=$RAM0SIZE|" config
225
 
226
echo "Set ramdisk_size=$RAMDISK_SIZE in cd-root/boot/DOS/config"
227
sed -i "s|^ramdisk_size=.*|ramdisk_size=$RAMDISK_SIZE|" cd-root/boot/DOS/config
228
 
229
echo
230
echo "--------------------------------------------"
231
echo "Run ./runme.sh"
232
echo "--------------------------------------------"
233
./runme.sh
234
 
235
echo
236
echo "--------------------------------------------"
237
echo "Now fix things to make this system bootable"
238
echo "--------------------------------------------"
239
cd ..
240
./restore-system.sh $PSI
241
 
242
 
243
echo "--------------------------------------------"
244
echo "End of Build LiveCD" 
245
echo "See /tmp for the ISO image"
246
echo "--------------------------------------------"