Re: [RFC v3] builddeb: Try to determine distribution

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

 



On Fri, Jan 2, 2015 at 10:23 PM, Thorsten Glaser <tg@xxxxxxxxx> wrote:
> Sedat Dilek dixit:
>
>>+# Try to determine distribution
>>+codename=$(lsb_release --codename --short 2> /dev/null)
>>+if [ -n "$KDEB_CHANGELOG_DIST" ]; then
>>+        distribution=$KDEB_CHANGELOG_DIST
>>+elif [ -n "$codename" ]; then
>
> This is suboptimal: if KDEB_CHANGELOG_DIST is defined,
> lsb_release is not necessary. The following snippet
> also omits using its output if it fails but still
> produces any:
>
> if test -n "$KDEB_CHANGELOG_DIST"; then
>         distribution=$KDEB_CHANGELOG_DIST
> elif distribution=$(lsb_release -cs 2>/dev/null) && test -n "$distribution"; then
>         :
> else
>         distribution=unstable
>         echo "builddeb: Using default distribution of 'unstable' in the changelog"
>         echo "builddeb: Set \$KDEB_CHANGELOG_DIST or install lsb-release to change this"
> fi
>

Happy 2015 mira!

Ben suggested originally...

So how about something like:

if [ -n "$KDEB_CHANGELOG_DIST" ]; then
        distribution="$KDEB_CHANGELOG_DIST"
elif ! distribution="$(lsb_release --codename --short 2>/dev/null)"; then
        distribution=unstable
        echo "I: Using default distribution of 'unstable' in the changelog"
        echo "I: Install lsb-release or set \$KDEB_CHANGELOG_DIST to
change this"
fi

Is that "inversion" doing the same?
I hoped to do it a bit more "human-readable" (for me) and made it worse.

How can I embed the name of the script "builddeb" into the outputs in
case we fall back to default distro-name?
BTW, builddeb is the script invoked via 'make deb-pkg'.

- Sedat -
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux