/[smeserver]/builds_bin/build_ISO
ViewVC logotype

Annotation of /builds_bin/build_ISO

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


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

1 gordonr 1.1 #!/bin/sh
2    
3 slords 1.17 distname='SME Server'
4     disttag='smeserver'
5 slords 1.22 distvers=$(basename $(readlink -f $(pwd)))
6 unnilennium 1.42 distrel=${distvers%%.*}
7 slords 1.17 distarch=$(uname -i)
8 jpp 1.43 user=$(whoami)
9 slords 1.17
10 slords 1.21 exec < /dev/null
11     exec &> build_ISO.$distarch
12    
13 slords 1.17 if ! [ -d $distarch ]
14 slords 1.15 then
15 slords 1.17 echo "No $distarch directory?"
16     exit 1
17     fi
18    
19 jpp 1.47 sudo chmod g+w $(pwd)/$distarch/{images,repodata,repoview,LiveOS}
20 jpp 1.43 for img in product updates EFI
21 slords 1.17 do
22 jpp 1.47 if [ -d "$(pwd)/$distarch/$img" -a "$img" = "product" ]
23 slords 1.17 then
24 jpp 1.47 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 jpp 1.43 elif [ -d "$(pwd)/$distarch/$img" -a "$img" = "EFI" ]
31 unnilennium 1.42 then
32 jpp 1.43 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 jpp 1.46 mkdir -p /tmp/{loop,remaster}
35 jpp 1.45 sudo mount -o loop $(pwd)/$distarch/images/efiboot.img /tmp/loop
36 jpp 1.44 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 slords 1.20 elif [ -d "$(pwd)/$distarch/$img" ]
48     then
49 jpp 1.43 echo "building $img.img...."
50 slords 1.17 /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 slords 1.32 rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso* ../iso/$distrel/$distarch/$disttag-$distarch.iso
59 slords 1.37 rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso*
60 slords 1.26 rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template
61 slords 1.17
62 jpp 1.43 if [ "$distrel" == "9" -o "$distrel" == "10" ]
63 slords 1.37 then
64 slords 1.39 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 slords 1.17 fi
69 slords 1.29 sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview
70 slords 1.17 repoview $(pwd)/$distarch/
71     sync; rm -rf $(pwd)/$distarch/.repodata
72    
73     bootimg='isolinux/isolinux.bin'
74     bootcat='isolinux/boot.cat'
75 jpp 1.43 efi_boot_file='images/efiboot.img'
76 slords 1.17 mkisopts='-v -U -J -r -T'
77     today="$(date '+%d %b %Y')"
78 unnilennium 1.42 if [ "$distrel" == "10" ]
79     then
80 jpp 1.43 #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 jpp 1.44 /usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \
98     $mkisopts -joliet-long \
99 jpp 1.43 -V "$distname" \
100 unnilennium 1.42 -A "$distname" \
101     -volset "$distname" \
102 jpp 1.43 -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 unnilennium 1.42 -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \
108     $(pwd)/$distarch/
109 jpp 1.43
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 unnilennium 1.42 else
122 slords 1.37 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 slords 1.17 -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \
128     $(pwd)/$distarch/
129 unnilennium 1.42 fi
130 slords 1.17
131 jpp 1.43 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 jpp 1.44 # 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 jpp 1.43 sudo chmod 664 /tmp/remaster/images/efiboot.img
158 jpp 1.44 # sudo rm -rf /tmp/remaster/efiboot
159 jpp 1.43 #rebuild iso for netinstall
160    
161 jpp 1.44 # /usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \
162     /usr/bin/xorriso -as mkisofs \
163 jpp 1.43 $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 slords 1.37
181 jpp 1.43 if [ "$distrel" == "10" ]
182 unnilennium 1.42 then
183 jpp 1.43 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 unnilennium 1.42 # should not be necessary with centos7 : mkisofs/mkhybrids and genisoimage have been merged
189     isohybrid ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso
190 jpp 1.43 else
191 unnilennium 1.42 # alternative with mkhybrid ??
192     echo "isohybrid not available; you should install syslinux or use genisoimage options"
193 jpp 1.43 fi
194 unnilennium 1.42 fi
195    
196 slords 1.38 if [ -x /usr/lib/anaconda-runtime/implantisomd5 ]
197     then
198     /usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso
199 jpp 1.43 #do it for the netinstall
200     /usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso
201 slords 1.38 else
202     implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso
203 jpp 1.43 #do it for the netinstall
204     implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso
205 slords 1.38 fi
206 slords 1.28 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 slords 1.19 zsyncmake -u $disttag-$distvers-$distarch.iso -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.zsync ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso
209 slords 1.32 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 jpp 1.43 # for netinstall
212 jpp 1.47 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 jpp 1.43
215 slords 1.17
216 slords 1.24 rsync -a --delete --delete-excluded \
217 jpp 1.43 --exclude 'repodata/' --exclude 'product/' --exclude 'updates/' --exclude 'efiboot/' --exclude 'repoview/' \
218 slords 1.24 --exclude 'lost+found/' --exclude 'CVS/' --exclude 'buildinstall.tree.*/' \
219     --link-dest=../$distarch/ $distarch/ $distarch.jigdo/
220 slords 1.37
221 slords 1.24 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 unnilennium 1.42 if [ -d SRPMS ] && [ "$distarch" == "i386" -o "$distrel" == "10" ]
231 slords 1.17 then
232 slords 1.35 rm -f ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso* ../iso/$distrel/source/$disttag-SRPMS.iso*
233 slords 1.17
234 slords 1.37 mkisofs $mkisopts -V "$distname" \
235     -A "$distname $distvers SRPMS created on $today" \
236 jpp 1.43 -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \
237 slords 1.17 -o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \
238 slords 1.37 --graft-points ./SRPMS=SRPMS GPL=$distarch/GPL \
239 slords 1.17 RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer
240    
241 slords 1.28 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 slords 1.19 zsyncmake -u $disttag-$distvers-SRPMS.iso -o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.zsync ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso
244 slords 1.17 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 slords 1.24
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 slords 1.37 SRPMS/
254 slords 1.15 fi
255 gordonr 1.5
256 gordonr 1.1 # That's it.

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