[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [live-build] "E: Unable to find a source package for syslinux,grub-efi"



On Wed, 11 Mar 2020 at 02:39, <jnqnfe@gmail.com> wrote:
>
> obviously it seems to be treating "syslinux,grub-efi" as a single
> package name which is wrong. this string originates from
> LB_BOOTLOADERS.
>
> the code that should be handling this in source_debian looks to be the
> following:
> ```
> echo "${LB_BOOTLOADERS}" | \
> while IFS="," read -r BOOTLOADER
> do
>         echo "${BOOTLOADER}" >> source-selection.txt
> done
> ```
>
> which is correctly specifying a comma as the separator, so if this is
> where the problem originates, I don't know why...

If you just need to parse comma-separated tokens from a string,
then maybe this code will work for you:

Demo code:

#!/bin/sh
s="a1,a2,a3,a4"
while [ -n "${s}" ] ; do
    # get $v = leading word of $s, by strip first comma and all following
    v=${s%%,*}
    # update $s according to $v
    if [ "${v}" != "${s}" ] ; then
        # update $s by remove leading $v and a comma from $s
        s=${s#${v},}
    else
        # $v=$s, so nothing was stripped, so nothing more to do
        s=''
    fi
    printf 'v=%s\n' "${v}"
done

The above demo code tested produces output:
v=a1
v=a2
v=a3
v=a4


Reply to: