From ac5acd6d0dd40655335b62ecc33db0937a322f6c Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Mon, 29 Jun 2020 14:30:42 +0800 Subject: initial meta distro support Now we support using an iso file directly other than first downloading it, this is very useful for iso files that update frequently (like openSUSE) or custom iso files. --- buildlive | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'buildlive') diff --git a/buildlive b/buildlive index ad607cb..120c14d 100755 --- a/buildlive +++ b/buildlive @@ -31,7 +31,7 @@ fatalerror() { usage() { >&2 cat << EOF -$0 [--root ] [options] [distro 1] [distro 2] ... +$0 [--root ] [options] [--distro= ] [distro] ... use $0 -L to list available distros options: --root @@ -103,6 +103,20 @@ do --clean) CLEAN_USB=1 ;; + --distro=*) + metadist="${1/--distro=}" + if [ ! -f "distro/$metadist/meta" ] + then + fatalerror "distro/$metadist/meta not found" + fi + shift + isofn="$1" + if [ ! -f "$isofn" ] + then + fatalerror "File $isofn not found" + fi + DISTROLIST=(${DISTROLIST[@]} "/meta@$metadist@$isofn") + ;; *=*|-*) usage exit 1 @@ -174,6 +188,17 @@ fi for i in ${DISTROLIST[@]} do + if [[ "$i" == /meta@* ]] + then + # FIXME: we assume the meta file path and the iso file name + # does not have '@' character + ISOFILE="$(echo "$i" | cut -d@ -f3)" + ISOLIST=("${ISOLIST[@]}" "$ISOFILE") + # TODO: we just use the file name as the ISO name + # can we do it better? + ISONAMELIST=("${ISONAMELIST[@]}" "$(basename "$ISOFILE")") + continue + fi process_isoinfo "$i" ISOLIST=("${ISOLIST[@]}" "$ISOFILE") ISONAMELIST=("${ISONAMELIST[@]}" "$ISONAME") @@ -199,16 +224,28 @@ do DISTRO="${DISTROLIST[$i-1]}" ISO_FILEPATH="$ISOPATH/$ISOFILE" - set_distro "$DISTRO" - export DISTRONAME KEYWORD # for grub and syslinux generation - - process_distro "$DISTRO" + if [[ "$DISTRO" == /meta@* ]] + then + metadir="$(echo "$DISTRO" | cut -d@ -f2)" + _meta=meta_ + ISO_FILEPATH="$ISOFILE" + DISTRO="$metadir" + set_distro "$metadir" + KEYWORD="$ISONAME" + source "distro/$metadir/meta" + else + _meta= + ISO_FILEPATH="$ISOPATH/$ISOFILE" + set_distro "$DISTRO" + export DISTRONAME KEYWORD # for grub and syslinux generation + process_distro "$DISTRO" + fi if [ "$GRUBCFG_ONLY" == 0 ]; then install_live fi - gen_grubcfg "$DISTRO" >> "$GRUBCFG" - gen_syslinux "$DISTRO" >> "$SYSLINUXCFG" + ${_meta}gen_grubcfg "$DISTRO" >> "$GRUBCFG" + ${_meta}gen_syslinux "$DISTRO" >> "$SYSLINUXCFG" done if [ "$GRUBCFG_ONLY" == 1 ]; then -- cgit v1.2.3