summaryrefslogtreecommitdiffstats
path: root/bootcd/build.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-07-04 23:08:02 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-07-04 23:08:02 +0200
commit127a9061b2af28e3cb59f67b5cf7268b59d312cd (patch)
treed8382b48f764181aaf87bfcbd741b0a3596fb4c8 /bootcd/build.sh
downloadkickstart-127a9061b2af28e3cb59f67b5cf7268b59d312cd.tar.gz
kickstart-127a9061b2af28e3cb59f67b5cf7268b59d312cd.tar.bz2
kickstart-127a9061b2af28e3cb59f67b5cf7268b59d312cd.tar.xz
kickstart-127a9061b2af28e3cb59f67b5cf7268b59d312cd.zip
Initial release
Diffstat (limited to 'bootcd/build.sh')
-rwxr-xr-xbootcd/build.sh78
1 files changed, 78 insertions, 0 deletions
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 <name.iso>' or 'isoinfo -d -i <name.iso>'
+#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 <distrib> [--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/