1 |
#!/bin/sh |
#!/bin/sh |
2 |
|
|
|
# Charlie Brady wrote on smeserver-developer: |
|
|
# [I'm sure I've said this before, but ...] there's no new anaconda SRPM. |
|
|
# The cdrom image I've been using comes directly from a CentOS one. |
|
|
|
|
|
# |
|
|
# What I've done is: |
|
|
# |
|
|
# - add CentOS/base/updates.img, made using mkcramfs from the updates directory |
|
|
# - delete unwanted RPMs |
|
|
# - add wanted RPMs |
|
|
# - replace comps.xml |
|
|
# - add install.cfg and update.cfg |
|
|
# - edit isolinux/isolinux.cfg |
|
|
# |
|
|
# Run this in the a 7.0alphaXX directory, containing cdrom.image |
|
|
# which contains the directory tree: |
|
|
|
|
|
|
|
|
echo "Checking packages not installed in CentOS workstation group" |
|
|
for package in anaconda anaconda-runtime bogl booty createrepo mkisofs zsync |
|
|
do |
|
|
rpm -q $package || exit "$package must be installed" |
|
|
done |
|
|
|
|
|
[ -d cdrom.image ] || (echo "No cdrom.image directory?"; exit 1) |
|
|
|
|
3 |
distname='SME Server' |
distname='SME Server' |
4 |
disttag='smeserver' |
disttag='smeserver' |
5 |
distvers=$(basename $(pwd)) |
distvers=$(basename $(readlink -f $(pwd))) |
6 |
|
distrel=${distvers%%.*} |
7 |
[ -f cdrom.image/updates/anaconda ] && chmod a+rx cdrom.image/updates/anaconda |
distarch=$(uname -i) |
8 |
|
user=$(whoami) |
9 |
|
|
10 |
|
exec < /dev/null |
11 |
|
exec &> build_ISO.$distarch |
12 |
|
|
13 |
|
if ! [ -d $distarch ] |
14 |
|
then |
15 |
|
echo "No $distarch directory?" |
16 |
|
exit 1 |
17 |
|
fi |
18 |
|
|
19 |
chmod -R a+rX cdrom.image |
for img in product updates EFI |
|
|
|
|
for img in product updates |
|
20 |
do |
do |
21 |
/usr/bin/mkcramfs \ |
if [ "$distrel" == "10" -a "$img" = "updates" ] |
22 |
$(pwd)/cdrom.image/$img \ |
then |
23 |
$(pwd)/cdrom.image/CentOS/base/$img.img |
echo "SME10 do nothing with updates.img, yet" |
24 |
|
elif [ -d "$(pwd)/$distarch/$img" -a "$img" = "EFI" ] |
25 |
|
then |
26 |
|
echo "building efiboot.img" |
27 |
|
# the content of the img should be /EFI/BOOT* and not /BOOT/*, so we need to copy the content in a temp dir |
28 |
|
sudo mount -o loop $(pwd)/$distarch/images/efiboot.img /tmp/loop |
29 |
|
sudo cp -a $(pwd)/$distarch/EFI/BOOT/grub.cfg /tmp/loop/EFI/BOOT/ |
30 |
|
sudo umount /tmp/loop |
31 |
|
# sudo rm -rf /tmp/efiboot |
32 |
|
# mkdir -p /tmp/efiboot |
33 |
|
# cp -a $(pwd)/$distarch/$img /tmp/efiboot |
34 |
|
# /sbin/mksquashfs \ |
35 |
|
# /tmp/efiboot \ |
36 |
|
# $(pwd)/$distarch/images/efiboot.img \ |
37 |
|
# -all-root -no-fragments -noappend |
38 |
|
# sudo chmod 664 $(pwd)/$distarch/images/efiboot.img |
39 |
|
# sudo rm -rf /tmp/efiboot |
40 |
|
elif [ -d "$(pwd)/$distarch/$img" ] |
41 |
|
then |
42 |
|
echo "building $img.img...." |
43 |
|
/sbin/mksquashfs \ |
44 |
|
$(pwd)/$distarch/$img \ |
45 |
|
$(pwd)/$distarch/images/$img.img \ |
46 |
|
-all-root -no-fragments -noappend |
47 |
|
sudo chmod 664 $(pwd)/$distarch/images/$img.img |
48 |
|
fi |
49 |
done |
done |
50 |
|
|
51 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso* ../iso/$distrel/$distarch/$disttag-$distarch.iso |
52 |
--withnumbers \ |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso* |
53 |
$(pwd)/cdrom.image/ |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template |
54 |
|
|
55 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/pkgorder \ |
if [ "$distrel" == "9" -o "$distrel" == "10" ] |
56 |
$(pwd)/cdrom.image \ |
then |
57 |
i386 > pkgorder |
mkdir -p $(pwd)/$distarch/repodata/ |
58 |
|
rm -f $(pwd)/$distarch/repodata/*comps.xml* |
59 |
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
/bin/cp -af $(pwd)/$distarch/Packages/base/comps.xml $(pwd)/$distarch/repodata/ |
60 |
--withnumbers \ |
createrepo --database --update --skip-symlinks --simple-md-filenames --groupfile repodata/comps.xml $(pwd)/$distarch/ |
61 |
--fileorder pkgorder \ |
fi |
62 |
$(pwd)/cdrom.image/ |
sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview |
63 |
|
repoview $(pwd)/$distarch/ |
64 |
rm -f $disttag-$distvers.iso smeserver.iso |
sync; rm -rf $(pwd)/$distarch/.repodata |
|
|
|
|
cd cdrom.image |
|
|
|
|
|
yum-arch . |
|
|
createrepo . |
|
65 |
|
|
66 |
bootimg='isolinux/isolinux.bin' |
bootimg='isolinux/isolinux.bin' |
67 |
bootcat='isolinux/boot.cat' |
bootcat='isolinux/boot.cat' |
68 |
#mkisopts='-r -N -L -d -D -J' |
efi_boot_file='images/efiboot.img' |
69 |
mkisopts='-r -J' |
mkisopts='-v -U -J -r -T' |
70 |
today="$(date '+%d %b %Y')" |
today="$(date '+%d %b %Y')" |
71 |
mkisofs $mkisopts \ |
if [ "$distrel" == "10" ] |
72 |
-V "$distname $distvers" \ |
then |
73 |
-A "$distname created on $today" \ |
#Caton |
74 |
-b "$bootimg" \ |
#xorriso -as mkisofs \ |
75 |
-c "$bootcat" \ |
#-o ../custom-SME10.iso \ |
76 |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
#-V "SME Server" \ |
77 |
-x lost+found \ |
#-A "SME Server" \ |
78 |
-x CVS \ |
#-joliet-long \ |
79 |
-o "../$disttag-$distvers".iso \ |
#-isohybrid-mbr images/efiboot.img \ |
80 |
. |
#-c isolinux/boot.cat \ |
81 |
|
#-b isolinux/isolinux.bin \ |
82 |
cd .. |
#-no-emul-boot \ |
83 |
/usr/lib/anaconda-runtime/implantisomd5 $disttag-$distvers.iso |
#-boot-load-size 4 \ |
84 |
dd if=/dev/zero bs=2048 count=150 >> $disttag-$distvers.iso |
#-boot-info-table \ |
85 |
md5sum $disttag-$distvers.iso > $disttag-$distvers.iso.md5sum |
#-eltorito-alt-boot \ |
86 |
ls -lRt > $disttag-$distvers.iso.ls-lRt |
#-e images/efiboot.img -no-emul-boot \ |
87 |
zsyncmake $disttag-$distvers.iso |
#-isohybrid-gpt-basdat \ |
88 |
mv $disttag-$distvers.iso $disttag.iso |
#-R -J -v -T . |
89 |
ln -sf $disttag.iso $disttag-$distvers.iso |
|
90 |
|
/usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ |
91 |
echo "Building SRPMS ISO" |
$mkisopts -joliet-long \ |
92 |
|
-V "$distname" \ |
93 |
mkisofs $mkisopts \ |
-A "$distname" \ |
94 |
-V "$distname $distvers SRPMS" \ |
-volset "$distname" \ |
95 |
-A "$distname SRPMS created on $today" \ |
-c "$bootcat" -b "$bootimg" \ |
96 |
-x lost+found \ |
-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
97 |
-x CVS \ |
-e "$efi_boot_file" \ |
98 |
-x cdrom.image \ |
-no-emul-boot -isohybrid-gpt-basdat \ |
99 |
-o "$disttag-$distvers-SRPMS".iso \ |
-x boot.iso -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ |
100 |
--graft-points \ |
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
101 |
./SRPMS=SRPMS \ |
$(pwd)/$distarch/ |
102 |
GPL=cdrom.image/GPL \ |
|
103 |
RPM-GPG-KEY=cdrom.image/RPM-GPG-KEY \ |
#mkisofs $mkisopts -joliet-long -V "$distname" \ |
104 |
RPM-GPG-KEY-centos4=cdrom.image/RPM-GPG-KEY-centos4 \ |
# -A "$distname" \ |
105 |
RPM-GPG-KEY-SMEServer7=cdrom.image/RPM-GPG-KEY-SMEServer7 |
# -volset "$distname" \ |
106 |
|
# -b "$bootimg" -c "$bootcat" \ |
107 |
md5sum $disttag-$distvers-SRPMS.iso > $disttag-$distvers-SRPMS.iso.md5sum |
# -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
108 |
zsyncmake $disttag-$distvers-SRPMS.iso |
# -efi-boot "$efi_boot_file" \ |
109 |
mv $disttag-$distvers-SRPMS.iso $disttag-SRPMS.iso |
# -no-emul-boot -isohybrid-gpt-basdat \ |
110 |
ln -sf $disttag-SRPMS.iso $disttag-$distvers-SRPMS.iso |
# -x boot.iso -x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ |
111 |
|
# -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
112 |
|
# $(pwd)/$distarch/ |
113 |
|
|
114 |
|
else |
115 |
|
mkisofs $mkisopts -V "$distname" \ |
116 |
|
-A "$distname $distvers created on $today" \ |
117 |
|
-b "$bootimg" -c "$bootcat" \ |
118 |
|
-no-emul-boot -boot-load-size 4 -boot-info-table -x boot.iso \ |
119 |
|
-x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ |
120 |
|
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
121 |
|
$(pwd)/$distarch/ |
122 |
|
fi |
123 |
|
|
124 |
|
if [ "$distrel" == "10" ] |
125 |
|
then |
126 |
|
#creating a root for netinstall |
127 |
|
mkdir -p /tmp/{loop,remaster} |
128 |
|
sudo mount -o loop $(pwd)/$distarch/images/boot.iso /tmp/loop |
129 |
|
# --no-perms --no-owner --no-group |
130 |
|
sudo rsync -av /tmp/loop/ /tmp/remaster/; sudo umount /tmp/loop |
131 |
|
sudo chown $user /tmp/remaster -R |
132 |
|
sudo chmod u+w /tmp/remaster -R |
133 |
|
#cp netinstall/ks.cfg /tmp/remaster/ |
134 |
|
cp -a $(pwd)/$distarch/netinstall/* /tmp/remaster/ |
135 |
|
cp -a $(pwd)/$distarch/images/product.img /tmp/remaster/images/ |
136 |
|
# rebuild the EFI efiboot.img for netinstall |
137 |
|
|
138 |
|
echo "building efiboot.img for netinstall" |
139 |
|
# the content of the img should be /EFI/BOOT* and not /BOOT/*, so we need to copy the content in a temp dir |
140 |
|
# sudo rm -rf /tmp/remaster/efiboot |
141 |
|
sudo mount -o loop /tmp/remaster/efiboot.img /tmp/loop |
142 |
|
sudo cp -a /tmp/remaster/EFI/BOOT/grub.cfg /tmp/loop/EFI/BOOT/ |
143 |
|
sudo umount /tmp/loop |
144 |
|
# mkdir -p /tmp/remaster/efiboot |
145 |
|
# cp -a /tmp/remaster/EFI $(pwd)/$distarch/efiboot |
146 |
|
# /sbin/mksquashfs \ |
147 |
|
# /tmp/remaster/efiboot \ |
148 |
|
# /tmp/remaster/images/efiboot.img \ |
149 |
|
# -all-root -no-fragments -noappend |
150 |
|
sudo chmod 664 /tmp/remaster/images/efiboot.img |
151 |
|
# sudo rm -rf /tmp/remaster/efiboot |
152 |
|
#rebuild iso for netinstall |
153 |
|
|
154 |
|
# /usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ |
155 |
|
/usr/bin/xorriso -as mkisofs \ |
156 |
|
$mkisopts -joliet-long \ |
157 |
|
-V "$distname" \ |
158 |
|
-A "$distname" \ |
159 |
|
-volset "$distname" \ |
160 |
|
-c "$bootcat" -b "$bootimg" \ |
161 |
|
-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
162 |
|
-e "$efi_boot_file" \ |
163 |
|
-no-emul-boot -isohybrid-gpt-basdat \ |
164 |
|
-x boot.iso -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ |
165 |
|
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso \ |
166 |
|
/tmp/remaster/ |
167 |
|
rm -rf /tmp/loop |
168 |
|
sudo rm -rf /tmp/remaster |
169 |
|
|
170 |
|
else |
171 |
|
cp -a $(pwd)/$distarch/images/boot.iso ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso |
172 |
|
fi |
173 |
|
|
174 |
|
if [ "$distrel" == "10" ] |
175 |
|
then |
176 |
|
echo "xorriso doing it, no need for isohybrid" |
177 |
|
else |
178 |
|
if [ -x /usr/bin/isohybrid ] |
179 |
|
then |
180 |
|
#needs syslinux; should implement efi ? --uefi ? |
181 |
|
# should not be necessary with centos7 : mkisofs/mkhybrids and genisoimage have been merged |
182 |
|
isohybrid ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
183 |
|
else |
184 |
|
# alternative with mkhybrid ?? |
185 |
|
echo "isohybrid not available; you should install syslinux or use genisoimage options" |
186 |
|
fi |
187 |
|
fi |
188 |
|
|
189 |
|
if [ -x /usr/lib/anaconda-runtime/implantisomd5 ] |
190 |
|
then |
191 |
|
/usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
192 |
|
#do it for the netinstall |
193 |
|
/usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso |
194 |
|
else |
195 |
|
implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
196 |
|
#do it for the netinstall |
197 |
|
implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso |
198 |
|
fi |
199 |
|
md5sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.md5sum |
200 |
|
sha1sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.sha1sum |
201 |
|
zsyncmake -u $disttag-$distvers-$distarch.iso -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.zsync ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
202 |
|
mv ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso ../iso/$distrel/$distarch/$disttag-$distarch.iso |
203 |
|
ln -sf $disttag-$distarch.iso ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
204 |
|
# for netinstall |
205 |
|
md5sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.md5sum |
206 |
|
sha1sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.sha1sum |
207 |
|
|
208 |
|
|
209 |
|
rsync -a --delete --delete-excluded \ |
210 |
|
--exclude 'repodata/' --exclude 'product/' --exclude 'updates/' --exclude 'efiboot/' --exclude 'repoview/' \ |
211 |
|
--exclude 'lost+found/' --exclude 'CVS/' --exclude 'buildinstall.tree.*/' \ |
212 |
|
--link-dest=../$distarch/ $distarch/ $distarch.jigdo/ |
213 |
|
|
214 |
|
jigdo-file make-template --force \ |
215 |
|
-i ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
216 |
|
-j ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo \ |
217 |
|
-t ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template \ |
218 |
|
--label SMEmirror=$distarch.jigdo/ \ |
219 |
|
--uri SMEmirror=http://mirror.contribs.org/releases/testing/$distrel/smeos/$distarch/ \ |
220 |
|
$distarch.jigdo// |
221 |
|
rm -rf $distarch.jigdo/ |
222 |
|
|
223 |
|
if [ -d SRPMS ] && [ "$distarch" == "i386" -o "$distrel" == "10" ] |
224 |
|
then |
225 |
|
rm -f ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso* ../iso/$distrel/source/$disttag-SRPMS.iso* |
226 |
|
|
227 |
|
mkisofs $mkisopts -V "$distname" \ |
228 |
|
-A "$distname $distvers SRPMS created on $today" \ |
229 |
|
-x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ |
230 |
|
-o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
231 |
|
--graft-points ./SRPMS=SRPMS GPL=$distarch/GPL \ |
232 |
|
RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer |
233 |
|
|
234 |
|
md5sum ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso | sed 's,\.\..*/,,' > ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.md5sum |
235 |
|
sha1sum ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso | sed 's,\.\..*/,,' > ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.sha1sum |
236 |
|
zsyncmake -u $disttag-$distvers-SRPMS.iso -o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.zsync ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso |
237 |
|
mv ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso ../iso/$distrel/source/$disttag-SRPMS.iso |
238 |
|
ln -sf $disttag-SRPMS.iso ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso |
239 |
|
|
240 |
|
jigdo-file make-template --force \ |
241 |
|
-i ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
242 |
|
-j ../iso/$distrel/source/$disttag-$distvers-SRPMS.jigdo \ |
243 |
|
-t ../iso/$distrel/source/$disttag-$distvers-SRPMS.template \ |
244 |
|
--label SMEmirror=SRPMS/ \ |
245 |
|
--uri SMEmirror=http://mirror.contribs.org/releases/testing/$distrel/smeos/SRPMS/ \ |
246 |
|
SRPMS/ |
247 |
|
fi |
248 |
|
|
249 |
# That's it. |
# That's it. |
|
|
|