--- builds_bin/build_ISO 2016/05/30 08:00:31 1.42 +++ builds_bin/build_ISO 2020/06/14 05:54:37 1.43 @@ -5,6 +5,7 @@ disttag='smeserver' distvers=$(basename $(readlink -f $(pwd))) distrel=${distvers%%.*} distarch=$(uname -i) +user=$(whoami) exec < /dev/null exec &> build_ISO.$distarch @@ -15,20 +16,27 @@ then exit 1 fi -for img in product updates +for img in product updates EFI do - if [ "$distrel" == "7" ] + if [ "$distrel" == "10" -a "$img" = "updates" ] then - rm -f $(pwd)/$distarch/SME/base/comps.rpm - cp -al $(pwd)/$distarch/SME/RPMS/comps-*.rpm $(pwd)/$distarch/SME/base/comps.rpm - /usr/bin/mkcramfs \ - $(pwd)/$distarch/$img \ - $(pwd)/$distarch/SME/base/$img.img - elif [ "$distrel" == "10" ] + echo "SME10 do nothing with updates.img, yet" + elif [ -d "$(pwd)/$distarch/$img" -a "$img" = "EFI" ] then - echo "SME10 do nothing there,yet" + echo "building efiboot.img" + # the content of the img should be /EFI/BOOT* and not /BOOT/*, so we need to copy the content in a temp dir + sudo rm -rf /tmp/efiboot + mkdir -p /tmp/efiboot + cp -a $(pwd)/$distarch/$img /tmp/efiboot + /sbin/mksquashfs \ + /tmp/efiboot \ + $(pwd)/$distarch/images/efiboot.img \ + -all-root -no-fragments -noappend + sudo chmod 664 $(pwd)/$distarch/images/efiboot.img + sudo rm -rf /tmp/efiboot elif [ -d "$(pwd)/$distarch/$img" ] then + echo "building $img.img...." /sbin/mksquashfs \ $(pwd)/$distarch/$img \ $(pwd)/$distarch/images/$img.img \ @@ -37,36 +45,11 @@ do fi done -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 - rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso* ../iso/$distrel/$distarch/$disttag-$distarch.iso rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso* rm -f ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.template -if [ "$distrel" == "7" ] -then - createrepo --update --database $(pwd)/$distarch/ -elif [ "$distrel" == "8" ] -then - createrepo --update --database --groupfile repodata/comps.xml -u "media://$(head -1 $distarch/.discinfo)" $(pwd)/$distarch/ -elif [ "$distrel" == "9" -o "$distrel" == "10" ] +if [ "$distrel" == "9" -o "$distrel" == "10" ] then mkdir -p $(pwd)/$distarch/repodata/ rm -f $(pwd)/$distarch/repodata/*comps.xml* @@ -79,18 +62,59 @@ sync; rm -rf $(pwd)/$distarch/.repodata bootimg='isolinux/isolinux.bin' bootcat='isolinux/boot.cat' +efi_boot_file='images/efiboot.img' mkisopts='-v -U -J -r -T' today="$(date '+%d %b %Y')" if [ "$distrel" == "10" ] then -mkisofs $mkisopts -V "$distname" \ +#Caton +#xorriso -as mkisofs -isohybrid-mbr isolinux/isohdpfx.bin \ +#-c isolinux/boot.cat -b isolinux/isolinux.bin +#-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ +#-e images/efiboot.img -no-emul-boot \ +#-isohybrid-gpt-basdat \ +#-o ../custom-SME10.iso . +# in fact it is : +#xorriso -as mkisofs \ +#-o ../custom-SME10.iso \ +#-V "SME Server" \ +#-A "SME Server" \ +#-joliet-long \ +#-isohybrid-mbr images/efiboot.img \ +#-c isolinux/boot.cat \ +#-b isolinux/isolinux.bin \ +#-no-emul-boot \ +#-boot-load-size 4 \ +#-boot-info-table \ +#-eltorito-alt-boot \ +#-e images/efiboot.img -no-emul-boot \ +#-isohybrid-gpt-basdat \ +#-R -J -v -T . + +/usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ + $mkisopts -joliet-long \ + -V "$distname" \ -A "$distname" \ -volset "$distname" \ - -b "$bootimg" -c "$bootcat" \ - -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -x boot.iso \ - -x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ + -c "$bootcat" -b "$bootimg" \ + -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ + -e "$efi_boot_file" \ + -no-emul-boot -isohybrid-gpt-basdat \ + -x boot.iso -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ $(pwd)/$distarch/ + +#mkisofs $mkisopts -joliet-long -V "$distname" \ +# -A "$distname" \ +# -volset "$distname" \ +# -b "$bootimg" -c "$bootcat" \ +# -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ +# -efi-boot "$efi_boot_file" \ +# -no-emul-boot -isohybrid-gpt-basdat \ +# -x boot.iso -x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ +# -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ +# $(pwd)/$distarch/ + else mkisofs $mkisopts -V "$distname" \ -A "$distname $distvers created on $today" \ @@ -101,32 +125,89 @@ mkisofs $mkisopts -V "$distname" \ $(pwd)/$distarch/ fi -cp -a $(pwd)/$distarch/images/boot.iso ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso +if [ "$distrel" == "10" ] +then + #creating a root for netinstall + mkdir -p /tmp/{loop,remaster} + sudo mount -o loop $(pwd)/$distarch/images/boot.iso /tmp/loop + # --no-perms --no-owner --no-group + sudo rsync -av /tmp/loop/ /tmp/remaster/; sudo umount /tmp/loop + sudo chown $user /tmp/remaster -R + sudo chmod u+w /tmp/remaster -R + #cp netinstall/ks.cfg /tmp/remaster/ + cp -a $(pwd)/$distarch/netinstall/* /tmp/remaster/ + cp -a $(pwd)/$distarch/images/product.img /tmp/remaster/images/ + # rebuild the EFI efiboot.img for netinstall + + echo "building efiboot.img for netinstall" + # the content of the img should be /EFI/BOOT* and not /BOOT/*, so we need to copy the content in a temp dir + sudo rm -rf /tmp/remaster/efiboot + mkdir -p /tmp/remaster/efiboot + cp -a /tmp/remaster/EFI $(pwd)/$distarch/efiboot + /sbin/mksquashfs \ + /tmp/remaster/efiboot \ + /tmp/remaster/images/efiboot.img \ + -all-root -no-fragments -noappend + sudo chmod 664 /tmp/remaster/images/efiboot.img + sudo rm -rf /tmp/remaster/efiboot + #rebuild iso for netinstall + + /usr/bin/xorriso -as mkisofs -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ + $mkisopts -joliet-long \ + -V "$distname" \ + -A "$distname" \ + -volset "$distname" \ + -c "$bootcat" -b "$bootimg" \ + -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ + -e "$efi_boot_file" \ + -no-emul-boot -isohybrid-gpt-basdat \ + -x boot.iso -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ + -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso \ + /tmp/remaster/ + rm -rf /tmp/loop + sudo rm -rf /tmp/remaster + +else + cp -a $(pwd)/$distarch/images/boot.iso ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso +fi -if [ -x /usr/bin/isohybrid ] +if [ "$distrel" == "10" ] then - #needs syslinux; should implement efi ? + echo "xorriso doing it, no need for isohybrid" +else + if [ -x /usr/bin/isohybrid ] + then + #needs syslinux; should implement efi ? --uefi ? # should not be necessary with centos7 : mkisofs/mkhybrids and genisoimage have been merged isohybrid ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso -else + else # alternative with mkhybrid ?? echo "isohybrid not available; you should install syslinux or use genisoimage options" + fi fi if [ -x /usr/lib/anaconda-runtime/implantisomd5 ] then /usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso + #do it for the netinstall + /usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso else implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso + #do it for the netinstall + implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso fi md5sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.md5sum sha1sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.sha1sum zsyncmake -u $disttag-$distvers-$distarch.iso -o ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.zsync ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso mv ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso ../iso/$distrel/$distarch/$disttag-$distarch.iso ln -sf $disttag-$distarch.iso ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso +# for netinstall +md5sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.md5sum +sha1sum ../iso/$distrel/$distarch/$disttag-$distvers-$distarch-netinstall.iso | sed 's,\.\..*/,,' > ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso.sha1sum + rsync -a --delete --delete-excluded \ - --exclude 'repodata/' --exclude 'product/' --exclude 'updates/' --exclude 'repoview/' \ + --exclude 'repodata/' --exclude 'product/' --exclude 'updates/' --exclude 'efiboot/' --exclude 'repoview/' \ --exclude 'lost+found/' --exclude 'CVS/' --exclude 'buildinstall.tree.*/' \ --link-dest=../$distarch/ $distarch/ $distarch.jigdo/ @@ -145,7 +226,7 @@ then mkisofs $mkisopts -V "$distname" \ -A "$distname $distvers SRPMS created on $today" \ - -x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ + -x lost+found -x product -x updates -x efiboot -x 'buildinstall.tree.*' -x CVS \ -o ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso \ --graft-points ./SRPMS=SRPMS GPL=$distarch/GPL \ RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer