/[smeserver]/builds_bin/build_ISO
ViewVC logotype

Contents of /builds_bin/build_ISO

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.47 - (show annotations) (download)
Sun Apr 28 18:53:34 2024 UTC (7 months ago) by jpp
Branch: MAIN
CVS Tags: HEAD
Changes since 1.46: +10 -4 lines
20240428

1 #!/bin/sh
2
3 distname='SME Server'
4 disttag='smeserver'
5 distvers=$(basename $(readlink -f $(pwd)))
6 distrel=${distvers%%.*}
7 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 sudo chmod g+w $(pwd)/$distarch/{images,repodata,repoview,LiveOS}
20 for img in product updates EFI
21 do
22 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
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
57
58 rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso* ../iso/$distrel/$distarch/$disttag-$distarch.iso
59 rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso*
60 rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template
61
62 if [ "$distrel" == "9" -o "$distrel" == "10" ]
63 then
64 mkdir -p $(pwd)/$distarch/repodata/
65 rm -f $(pwd)/$distarch/repodata/*comps.xml*
66 /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
69 sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview
70 repoview $(pwd)/$distarch/
71 sync; rm -rf $(pwd)/$distarch/.repodata
72
73 bootimg='isolinux/isolinux.bin'
74 bootcat='isolinux/boot.cat'
75 efi_boot_file='images/efiboot.img'
76 mkisopts='-v -U -J -r -T'
77 today="$(date '+%d %b %Y')"
78 if [ "$distrel" == "10" ]
79 then
80 #Caton
81 #xorriso -as mkisofs \
82 #-o ../custom-SME10.iso \
83 #-V "SME Server" \
84 #-A "SME Server" \
85 #-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 \
108 $(pwd)/$distarch/
109
110 #mkisofs $mkisopts -joliet-long -V "$distname" \
111 # -A "$distname" \
112 # -volset "$distname" \
113 # -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
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.

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed