--- builds_bin/build_ISO 2010/05/27 14:42:06 1.32 +++ builds_bin/build_ISO 2020/06/15 04:40:42 1.46 @@ -3,8 +3,9 @@ distname='SME Server' disttag='smeserver' distvers=$(basename $(readlink -f $(pwd))) -distrel=${distvers:0:1} +distrel=${distvers%%.*} distarch=$(uname -i) +user=$(whoami) exec < /dev/null exec &> build_ISO.$distarch @@ -15,17 +16,31 @@ 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 + echo "SME10 do nothing with updates.img, yet" + elif [ -d "$(pwd)/$distarch/$img" -a "$img" = "EFI" ] + then + 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 + mkdir -p /tmp/{loop,remaster} + sudo mount -o loop $(pwd)/$distarch/images/efiboot.img /tmp/loop + sudo cp -a $(pwd)/$distarch/EFI/BOOT/grub.cfg /tmp/loop/EFI/BOOT/ + sudo umount /tmp/loop +# 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 \ @@ -34,33 +49,16 @@ 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" ] +if [ "$distrel" == "9" -o "$distrel" == "10" ] then - createrepo --update --database $(pwd)/$distarch/ -else - createrepo --update --database --groupfile repodata/comps.xml -u "media://$(head -1 $distarch/.discinfo)" $(pwd)/$distarch/ + mkdir -p $(pwd)/$distarch/repodata/ + rm -f $(pwd)/$distarch/repodata/*comps.xml* + /bin/cp -af $(pwd)/$distarch/Packages/base/comps.xml $(pwd)/$distarch/repodata/ + createrepo --database --update --skip-symlinks --simple-md-filenames --groupfile repodata/comps.xml $(pwd)/$distarch/ fi sync; rm -rf $(pwd)/$distarch/.olddata $(pwd)/$distarch/repodata/repoview $(pwd)/$distarch/repoview repoview $(pwd)/$distarch/ @@ -68,30 +66,152 @@ 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')" -mkisofs $mkisopts \ - -V "$distname $distvers" \ - -A "$distname created on $today" \ - -b "$bootimg" \ - -c "$bootcat" \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ +if [ "$distrel" == "10" ] +then +#Caton +#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" \ + -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" \ + -b "$bootimg" -c "$bootcat" \ + -no-emul-boot -boot-load-size 4 -boot-info-table -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/ +fi -/usr/lib/anaconda-runtime/implantisomd5 ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso -dd if=/dev/zero bs=2048 count=150 >> ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.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 + sudo mount -o loop /tmp/remaster/efiboot.img /tmp/loop + sudo cp -a /tmp/remaster/EFI/BOOT/grub.cfg /tmp/loop/EFI/BOOT/ + sudo umount /tmp/loop +# 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 \ + /usr/bin/xorriso -as mkisofs \ + $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 [ "$distrel" == "10" ] +then + 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 + # 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/ + jigdo-file make-template --force \ -i ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.iso \ -j ../iso/$distrel/$distarch/$disttag-$distvers-$distarch.jigdo \ @@ -101,18 +221,15 @@ jigdo-file make-template --force \ $distarch.jigdo// rm -rf $distarch.jigdo/ -if [ -d SRPMS -a "$distarch" == "i386" ] +if [ -d SRPMS ] && [ "$distarch" == "i386" -o "$distrel" == "10" ] then - 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* - mkisofs $mkisopts \ - -V "$distname $distvers SRPMS" \ - -A "$distname SRPMS created on $today" \ - -x lost+found -x product -x updates -x 'buildinstall.tree.*' -x CVS \ + mkisofs $mkisopts -V "$distname" \ + -A "$distname $distvers SRPMS created on $today" \ + -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 \ + --graft-points ./SRPMS=SRPMS GPL=$distarch/GPL \ RPM-GPG-KEY-SMEServer=$distarch/RPM-GPG-KEY-SMEServer md5sum ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso | sed 's,\.\..*/,,' > ../iso/$distrel/source/$disttag-$distvers-SRPMS.iso.md5sum @@ -127,7 +244,7 @@ then -t ../iso/$distrel/source/$disttag-$distvers-SRPMS.template \ --label SMEmirror=SRPMS/ \ --uri SMEmirror=http://mirror.contribs.org/releases/testing/$distrel/smeos/SRPMS/ \ - SRPMS// + SRPMS/ fi # That's it.