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