2 |
|
|
3 |
distname='SME Server' |
distname='SME Server' |
4 |
disttag='smeserver' |
disttag='smeserver' |
5 |
distvers=$(basename $(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 |
11 |
|
exec &> build_ISO.$distarch |
12 |
|
|
13 |
if ! [ -d $distarch ] |
if ! [ -d $distarch ] |
14 |
then |
then |
16 |
exit 1 |
exit 1 |
17 |
fi |
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 |
if [ "$distrel" == "7" ] |
if [ -d "$(pwd)/$distarch/$img" -a "$img" = "product" ] |
23 |
|
then |
24 |
|
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 |
then |
32 |
/usr/bin/mkcramfs \ |
echo "building efiboot.img" |
33 |
$(pwd)/$distarch/$img \ |
# the content of the img should be /EFI/BOOT* and not /BOOT/*, so we need to copy the content in a temp dir |
34 |
$(pwd)/$distarch/SME/base/$img.img |
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" ] |
elif [ -d "$(pwd)/$distarch/$img" ] |
48 |
then |
then |
49 |
|
echo "building $img.img...." |
50 |
/sbin/mksquashfs \ |
/sbin/mksquashfs \ |
51 |
$(pwd)/$distarch/$img \ |
$(pwd)/$distarch/$img \ |
52 |
$(pwd)/$distarch/images/$img.img \ |
$(pwd)/$distarch/images/$img.img \ |
55 |
fi |
fi |
56 |
done |
done |
57 |
|
|
58 |
if [ "$distrel" == "7" ] |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso* ../iso/$distrel/$distarch/$disttag-$distarch.iso |
59 |
then |
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso* |
60 |
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 |
|
|
|
|
|
PYTHONPATH=/usr/lib/anaconda/ /usr/lib/anaconda-runtime/genhdlist \ |
|
|
--productpath SME \ |
|
|
--withnumbers \ |
|
|
--fileorder pkgorder.$distarch \ |
|
|
$(pwd)/$distarch/ |
|
|
fi |
|
|
|
|
|
rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso ../iso/$distrel/$distarch/$disttag.iso |
|
61 |
|
|
62 |
if [ "$distrel" == "7" ] |
if [ "$distrel" == "9" -o "$distrel" == "10" ] |
63 |
then |
then |
64 |
createrepo $(pwd)/$distarch/ |
mkdir -p $(pwd)/$distarch/repodata/ |
65 |
else |
rm -f $(pwd)/$distarch/repodata/*comps.xml* |
66 |
createrepo -g repodata/comps.xml -u "media://$(head -1 $distarch/.discinfo)" $(pwd)/$distarch/ |
/bin/cp -af $(pwd)/$distarch/Packages/base/comps.xml $(pwd)/$distarch/repodata/ |
67 |
|
createrepo --database --update --skip-symlinks --simple-md-filenames --groupfile repodata/comps.xml $(pwd)/$distarch/ |
68 |
fi |
fi |
69 |
sync; rm -rf $(pwd)/$distarch/.olddata |
sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview |
70 |
repoview $(pwd)/$distarch/ |
repoview $(pwd)/$distarch/ |
71 |
sync; rm -rf $(pwd)/$distarch/.repodata |
sync; rm -rf $(pwd)/$distarch/.repodata |
72 |
|
|
73 |
bootimg='isolinux/isolinux.bin' |
bootimg='isolinux/isolinux.bin' |
74 |
bootcat='isolinux/boot.cat' |
bootcat='isolinux/boot.cat' |
75 |
|
efi_boot_file='images/efiboot.img' |
76 |
mkisopts='-v -U -J -r -T' |
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 |
|
#-isohybrid-mbr images/efiboot.img \ |
87 |
|
#-c isolinux/boot.cat \ |
88 |
|
#-b isolinux/isolinux.bin \ |
89 |
|
#-no-emul-boot \ |
90 |
|
#-boot-load-size 4 \ |
91 |
|
#-boot-info-table \ |
92 |
|
#-eltorito-alt-boot \ |
93 |
|
#-e images/efiboot.img -no-emul-boot \ |
94 |
|
#-isohybrid-gpt-basdat \ |
95 |
|
#-R -J -v -T . |
96 |
|
|
97 |
|
/usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ |
98 |
|
$mkisopts -joliet-long \ |
99 |
|
-V "$distname" \ |
100 |
|
-A "$distname" \ |
101 |
|
-volset "$distname" \ |
102 |
|
-c "$bootcat" -b "$bootimg" \ |
103 |
|
-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
104 |
|
-e "$efi_boot_file" \ |
105 |
|
-no-emul-boot -isohybrid-gpt-basdat \ |
106 |
|
-x boot.iso -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ |
107 |
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
-o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
108 |
$(pwd)/$distarch/ |
$(pwd)/$distarch/ |
109 |
|
|
110 |
/usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
#mkisofs $mkisopts -joliet-long -V "$distname" \ |
111 |
dd if=/dev/zero bs=2048 count=150 >> ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
# -A "$distname" \ |
112 |
md5sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.md5sum |
# -volset "$distname" \ |
113 |
sha1sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.sha1sum |
# -b "$bootimg" -c "$bootcat" \ |
114 |
|
# -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ |
115 |
|
# -efi-boot "$efi_boot_file" \ |
116 |
|
# -no-emul-boot -isohybrid-gpt-basdat \ |
117 |
|
# -x boot.iso -x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ |
118 |
|
# -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ |
119 |
|
# $(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 |
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.iso |
mv ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso ../iso/$distrel/$distarch/$disttag-$distarch.iso |
210 |
ln -sf $disttag.iso ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso |
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 -a "$distarch" == "i386" ] |
if [ -d SRPMS ] && [ "$distarch" == "i386" -o "$distrel" == "10" ] |
231 |
then |
then |
232 |
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* |
233 |
|
|
234 |
mkisofs $mkisopts \ |
mkisofs $mkisopts -V "$distname" \ |
235 |
-V "$distname $distvers SRPMS" \ |
-A "$distname $distvers SRPMS created on $today" \ |
236 |
-A "$distname SRPMS created on $today" \ |
-x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ |
|
-x lost+found \ |
|
|
-x CVS \ |
|
237 |
-o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
-o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ |
238 |
--graft-points \ |
--graft-points ./SRPMS=SRPMS GPL=$distarch/GPL \ |
|
./SRPMS=SRPMS \ |
|
|
GPL=$distarch/GPL \ |
|
239 |
RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer |
RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer |
240 |
|
|
241 |
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 |
242 |
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 |
243 |
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 |
244 |
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 |
245 |
ln -sf $disttag-SRPMS.iso ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso |
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 |
fi |
255 |
|
|
256 |
# That's it. |
# That's it. |
|
|
|