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