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 |
# remove package that are no longer in the distro |
for img in product updates EFI |
|
if [ "$distrel" == "8" ] |
|
|
then |
|
|
find -name 'samba-*.sme.*' -print0 -o \ |
|
|
-name 'libsmbclient-*.sme.*' -print0 -o \ |
|
|
-name 'libtalloc-*.sme.*' -print0 -o \ |
|
|
-name 'libtdb-*.sme.*' -print0 -o \ |
|
|
-name 'tdb-tools-*.sme.*' -print0 \ |
|
|
-name 'libtdb-*.sme.*' -print0 \ |
|
|
| xargs -r0 rm |
|
|
fi |
|
|
|
|
|
|
|
|
for img in product updates |
|
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 |
|
sudo rm -rf /tmp/efiboot |
29 |
|
mkdir -p /tmp/efiboot |
30 |
|
cp -a $(pwd)/$distarch/$img /tmp/efiboot |
31 |
|
/sbin/mksquashfs \ |
32 |
|
/tmp/efiboot \ |
33 |
|
$(pwd)/$distarch/images/efiboot.img \ |
34 |
|
-all-root -no-fragments -noappend |
35 |
|
sudo chmod 664 $(pwd)/$distarch/images/efiboot.img |
36 |
|
sudo rm -rf /tmp/efiboot |
37 |
elif [ -d "$(pwd)/$distarch/$img" ] |
elif [ -d "$(pwd)/$distarch/$img" ] |
38 |
then |
then |
39 |
|
echo "building $img.img...." |
40 |
/sbin/mksquashfs \ |
/sbin/mksquashfs \ |
41 |
$(pwd)/$distarch/$img \ |
$(pwd)/$distarch/$img \ |
42 |
$(pwd)/$distarch/images/$img.img \ |
$(pwd)/$distarch/images/$img.img \ |
45 |
fi |
fi |
46 |
done |
done |
47 |
|
|
|
if [ "$distrel" == "7" ] |
|
|
then |
|
|
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
|
|
--productpath SME \ |
|
|
--withnumbers \ |
|
|
$(pwd)/$distarch/ |
|
|
|
|
|
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/pkgorder \ |
|
|
--product SME \ |
|
|
$(pwd)/$distarch \ |
|
|
$distarch > pkgorder.$distarch |
|
|
|
|
|
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
|
|
--productpath SME \ |
|
|
--withnumbers \ |
|
|
--fileorder pkgorder.$distarch \ |
|
|
$(pwd)/$distarch/ |
|
|
fi |
|
|
|
|
48 |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso* ../iso/$distrel/$distarch/$disttag-$distarch.iso |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso* ../iso/$distrel/$distarch/$disttag-$distarch.iso |
49 |
|
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso* |
50 |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template |
51 |
|
|
52 |
if [ "$distrel" == "7" ] |
if [ "$distrel" == "9" -o "$distrel" == "10" ] |
53 |
then |
then |
54 |
createrepo --update --database $(pwd)/$distarch/ |
mkdir -p $(pwd)/$distarch/repodata/ |
55 |
else |
rm -f $(pwd)/$distarch/repodata/*comps.xml* |
56 |
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/ |
57 |
|
createrepo --database --update --skip-symlinks --simple-md-filenames --groupfile repodata/comps.xml $(pwd)/$distarch/ |
58 |
fi |
fi |
59 |
sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview |
sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview |
60 |
repoview $(pwd)/$distarch/ |
repoview $(pwd)/$distarch/ |
62 |
|
|
63 |
bootimg='isolinux/isolinux.bin' |
bootimg='isolinux/isolinux.bin' |
64 |
bootcat='isolinux/boot.cat' |
bootcat='isolinux/boot.cat' |
65 |
|
efi_boot_file='images/efiboot.img' |
66 |
mkisopts='-v -U -J -r -T' |
mkisopts='-v -U -J -r -T' |
67 |
today="$(date '+%d %b %Y')" |
today="$(date '+%d %b %Y')" |
68 |
mkisofs $mkisopts \ |
if [ "$distrel" == "10" ] |
69 |
-V "$distname $distvers" \ |
then |
70 |
-A "$distname created on $today" \ |
#Caton |
71 |
-b "$bootimg" \ |
#xorriso -as mkisofs -isohybrid-mbr isolinux/isohdpfx.bin \ |
72 |
-c "$bootcat" \ |
#-c isolinux/boot.cat -b isolinux/isolinux.bin |
73 |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
#-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
74 |
|
#-e images/efiboot.img -no-emul-boot \ |
75 |
|
#-isohybrid-gpt-basdat \ |
76 |
|
#-o ../custom-SME10.iso . |
77 |
|
# in fact it is : |
78 |
|
#xorriso -as mkisofs \ |
79 |
|
#-o ../custom-SME10.iso \ |
80 |
|
#-V "SME Server" \ |
81 |
|
#-A "SME Server" \ |
82 |
|
#-joliet-long \ |
83 |
|
#-isohybrid-mbr images/efiboot.img \ |
84 |
|
#-c isolinux/boot.cat \ |
85 |
|
#-b isolinux/isolinux.bin \ |
86 |
|
#-no-emul-boot \ |
87 |
|
#-boot-load-size 4 \ |
88 |
|
#-boot-info-table \ |
89 |
|
#-eltorito-alt-boot \ |
90 |
|
#-e images/efiboot.img -no-emul-boot \ |
91 |
|
#-isohybrid-gpt-basdat \ |
92 |
|
#-R -J -v -T . |
93 |
|
|
94 |
|
/usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ |
95 |
|
$mkisopts -joliet-long \ |
96 |
|
-V "$distname" \ |
97 |
|
-A "$distname" \ |
98 |
|
-volset "$distname" \ |
99 |
|
-c "$bootcat" -b "$bootimg" \ |
100 |
|
-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
101 |
|
-e "$efi_boot_file" \ |
102 |
|
-no-emul-boot -isohybrid-gpt-basdat \ |
103 |
|
-x boot.iso -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ |
104 |
|
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
105 |
|
$(pwd)/$distarch/ |
106 |
|
|
107 |
|
#mkisofs $mkisopts -joliet-long -V "$distname" \ |
108 |
|
# -A "$distname" \ |
109 |
|
# -volset "$distname" \ |
110 |
|
# -b "$bootimg" -c "$bootcat" \ |
111 |
|
# -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
112 |
|
# -efi-boot "$efi_boot_file" \ |
113 |
|
# -no-emul-boot -isohybrid-gpt-basdat \ |
114 |
|
# -x boot.iso -x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ |
115 |
|
# -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
116 |
|
# $(pwd)/$distarch/ |
117 |
|
|
118 |
|
else |
119 |
|
mkisofs $mkisopts -V "$distname" \ |
120 |
|
-A "$distname $distvers created on $today" \ |
121 |
|
-b "$bootimg" -c "$bootcat" \ |
122 |
|
-no-emul-boot -boot-load-size 4 -boot-info-table -x boot.iso \ |
123 |
-x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ |
-x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ |
124 |
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
125 |
$(pwd)/$distarch/ |
$(pwd)/$distarch/ |
126 |
|
fi |
127 |
|
|
128 |
|
if [ "$distrel" == "10" ] |
129 |
|
then |
130 |
|
#creating a root for netinstall |
131 |
|
mkdir -p /tmp/{loop,remaster} |
132 |
|
sudo mount -o loop $(pwd)/$distarch/images/boot.iso /tmp/loop |
133 |
|
# --no-perms --no-owner --no-group |
134 |
|
sudo rsync -av /tmp/loop/ /tmp/remaster/; sudo umount /tmp/loop |
135 |
|
sudo chown $user /tmp/remaster -R |
136 |
|
sudo chmod u+w /tmp/remaster -R |
137 |
|
#cp netinstall/ks.cfg /tmp/remaster/ |
138 |
|
cp -a $(pwd)/$distarch/netinstall/* /tmp/remaster/ |
139 |
|
cp -a $(pwd)/$distarch/images/product.img /tmp/remaster/images/ |
140 |
|
# rebuild the EFI efiboot.img for netinstall |
141 |
|
|
142 |
|
echo "building efiboot.img for netinstall" |
143 |
|
# the content of the img should be /EFI/BOOT* and not /BOOT/*, so we need to copy the content in a temp dir |
144 |
|
sudo rm -rf /tmp/remaster/efiboot |
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 |
|
$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 |
/usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
if [ -x /usr/lib/anaconda-runtime/implantisomd5 ] |
190 |
dd if=/dev/zero bs=2048 count=150 >> ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
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 |
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 |
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 |
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 |
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 |
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 \ |
rsync -a --delete --delete-excluded \ |
210 |
--exclude 'repodata/' --exclude 'product/' --exclude 'updates/' --exclude 'repoview/' \ |
--exclude 'repodata/' --exclude 'product/' --exclude 'updates/' --exclude 'efiboot/' --exclude 'repoview/' \ |
211 |
--exclude 'lost+found/' --exclude 'CVS/' --exclude 'buildinstall.tree.*/' \ |
--exclude 'lost+found/' --exclude 'CVS/' --exclude 'buildinstall.tree.*/' \ |
212 |
--link-dest=../$distarch/ $distarch/ $distarch.jigdo/ |
--link-dest=../$distarch/ $distarch/ $distarch.jigdo/ |
213 |
|
|
214 |
jigdo-file make-template --force \ |
jigdo-file make-template --force \ |
215 |
-i ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
-i ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
216 |
-j ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo \ |
-j ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo \ |
220 |
$distarch.jigdo// |
$distarch.jigdo// |
221 |
rm -rf $distarch.jigdo/ |
rm -rf $distarch.jigdo/ |
222 |
|
|
223 |
if [ -d SRPMS -a "$distarch" == "i386" ] |
if [ -d SRPMS ] && [ "$distarch" == "i386" -o "$distrel" == "10" ] |
224 |
then |
then |
225 |
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* |
226 |
|
|
227 |
mkisofs $mkisopts \ |
mkisofs $mkisopts -V "$distname" \ |
228 |
-V "$distname $distvers SRPMS" \ |
-A "$distname $distvers SRPMS created on $today" \ |
229 |
-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 \ |
|
230 |
-o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
-o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
231 |
--graft-points \ |
--graft-points ./SRPMS=SRPMS GPL=$distarch/GPL \ |
|
./SRPMS=SRPMS \ |
|
|
GPL=$distarch/GPL \ |
|
232 |
RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer |
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 |
md5sum ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso | sed 's,\.\..*/,,' > ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.md5sum |
243 |
-t ../iso/$distrel/source/$disttag-$distvers-SRPMS.template \ |
-t ../iso/$distrel/source/$disttag-$distvers-SRPMS.template \ |
244 |
--label SMEmirror=SRPMS/ \ |
--label SMEmirror=SRPMS/ \ |
245 |
--uri SMEmirror=http://mirror.contribs.org/releases/testing/$distrel/smeos/SRPMS/ \ |
--uri SMEmirror=http://mirror.contribs.org/releases/testing/$distrel/smeos/SRPMS/ \ |
246 |
SRPMS// |
SRPMS/ |
247 |
fi |
fi |
248 |
|
|
249 |
# That's it. |
# That's it. |