From 127a9061b2af28e3cb59f67b5cf7268b59d312cd Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 4 Jul 2018 23:08:02 +0200 Subject: Initial release --- bootcd/build.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 bootcd/build.sh (limited to 'bootcd/build.sh') diff --git a/bootcd/build.sh b/bootcd/build.sh new file mode 100755 index 0000000..153ecf0 --- /dev/null +++ b/bootcd/build.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +#inst.stage2 in isolinux.cfg needs to match the label of ISO, to get lable use 'file ' or 'isoinfo -d -i ' +#Lantronix Spider does not provide CDROM labels (we can add inst.stage2=cdrom, but this may break booting on multicd systems) +centos74_label="CentOS 7 x86_64" +centos75_label="CentOS 7 x86_64" +fedora28_label="Fedora-S-dvd-x86_64-28" + +die() { echo "$*" 1>&2 ; exit 1; } +usage() { echo "Usage: $0 [--cdrom]"; } + +[ $# -gt 0 ] || { usage; exit 1; } + +distrib=$(echo $1 | grep -oP '[\w\d_\-]+') +label_arg=$(echo ${distrib}_label) +label_std=${!label_arg} + +[ -d $distrib ] || die "$distrib is not found" +[ -n "$label_std" ] || die "Label for $distrib is not configured" + +shift + +ver=1 +rhver=$(echo $distrib | grep -oP '\d+') +dname=$(echo $distrib | grep -oP '[^\d]+') + + +extra="" +isoname="$distrib-ands$(if [ $ver -gt 1 ]; then echo $ver ; fi)" + +while [ $# -gt 0 ]; do + case "$1" in + --cdrom) + media=$(if [[ "$2" =~ ^[[:alnum:]] ]]; then echo $2; else echo "cdrom"; fi) + extra="$extra inst.stage2=$media" + isoname="$isoname-$media" + echo $media + shift $(if [[ "$2" =~ ^[[:alnum:]] ]]; then echo 2; else echo 1; fi) + ;; + h | *) usage; exit 0 ;; + esac +done + + +isolinux="isolinux-${distrib}.cfg" +[ -f $isolinux ] || isolinux="isolinux-${dname}.cfg" +[ -f $isolinux ] || die "Configuration $isolinux is not found" + +echo "Building ${isoname}.iso with extra parameters \"$extra\" and the label \"$label_std\"" +echo "Using configuration: $isolinux" + +#Generating config +chmod +w $distrib/isolinux +chmod +w $distrib/isolinux/isolinux.cfg +sed -e "s/@EXTRA@/$extra/g" $isolinux > $distrib/isolinux/isolinux.cfg || die "Can't overwrite the configuration" + +#Creating output folder +mkdir -p iso + +#Building ISO +( + cd $distrib || die "Can't chdir" + chmod 664 isolinux/isolinux.bin + + rm -f iso/${isoname}.iso + +# On Forums Disc1 label is recommended, but it is not recognized (at least by Fedora) +# mkisofs -o ../iso/${isoname}.iso -A "$label_std" -V "$label_std Disc 1" -volset "$label_std" \ + + mkisofs -o ../iso/${isoname}.iso -A "$label_std" -V "$label_std" -volset "$label_std" \ + -U -J -joliet-long -r -v -T \ + -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \ + -eltorito-alt-boot -e images/efiboot.img -no-emul-boot \ + . +) + +#Installing +scp iso/${isoname}.iso root@192.168.26.134:/virtual/images/ -- cgit v1.2.3