diff options
author | Iru Cai <mytbk920423@gmail.com> | 2020-06-29 14:30:42 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2021-03-30 13:08:45 +0800 |
commit | ac5acd6d0dd40655335b62ecc33db0937a322f6c (patch) | |
tree | 7d5ce24ca3cc5543621cc736df334337043006e4 /buildlive | |
parent | a42acb2e3d3f823e8db5725eb543e74e9cae32bc (diff) | |
download | liveusb-builder-ac5acd6d0dd40655335b62ecc33db0937a322f6c.tar.xz |
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.
Diffstat (limited to 'buildlive')
-rwxr-xr-x | buildlive | 51 |
1 files changed, 44 insertions, 7 deletions
@@ -31,7 +31,7 @@ fatalerror() { usage() { >&2 cat << EOF -$0 [--root <path>] [options] [distro 1] [distro 2] ... +$0 [--root <path>] [options] [--distro=<metadist> <isofile>] [distro] ... use $0 -L to list available distros options: --root <path> @@ -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 |