Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2006 10:55:37 -0600
From:      "Scot Hetzel" <swhetzel@gmail.com>
To:        "Ion-Mihai Tetcu" <itetcu@people.tecnik93.com>
Cc:        freebsd-ports@freebsd.org, Jeremy Chadwick <freebsd@jdc.parodius.com>
Subject:   Re: Which ports store/use OPTIONS (/var/db/ports/portname/options)?
Message-ID:  <790a9fff0602280855r3d596be3v4b257e7ec4689203@mail.gmail.com>
In-Reply-To: <20060228154636.3e114177@it.buh.tecnik93.com>
References:  <867j7gd8kw.fsf@PECTOPAH.shenton.org> <20060228083210.GI13185@goofy.cultdeadsheep.org> <20060228103912.GA166@pentarou.parodius.com> <20060228154636.3e114177@it.buh.tecnik93.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> > Additionally, there needs to be dialog --inputbox support for OPTIONS
> > to become useful.
>
> And a way to have 2 or more OPTIONS exclude each other, and sub-OPTIONS
> based on selected options, etc.
>
To have 2 or more OPTIONS exclude each other 'dialog --menu' could be
used.  To make this useful there would need to a way to specify
multiple 'dialog --menus'.

i.e:
    OPTIONS_CHKLST=3D OPTIONS CHKLST2
    OPTIONS_INPUT=3D USER GROUP
    OPTIONS_MENU=3D MNU1 MNU2

    OPTIONS=3D  tag "description text1" \
                     tag2 "description text 2"

    CHKLST2=3D tag "description text1" \
                     tag2 "description text 2"

    OPTIONS_MNU1_TITLE=3D"Choose a Database backend"
    OPTIONS_MNU1_OPTIONS=3D "MYSQL Enable Mysql Support" \
                                                "PGSQL Enable Pgsql Support=
"
The code for the 'dialog --menu' would be similar to the current
'dialog --checklist', except it would only enable one option.

    OPTIONS_USER_QUESTION=3D"What user do you want to run Apache as?"
    OPTIONS_GROUP_QUESTION=3D"What group do you want to run Apache as?"

The code for multiple input boxes could be:

.if defined(OPTIONS_INPUT}
.for MNU in ${OPTIONS_INPUT}
=09TMPOPTIONSFILE=3D$$(mktemp -t portmnuoptions); \
=09trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
=09${SH} -c "${DIALOG} --inputbox $${OPTIONS_${MNU}_QUESTION} 1 70 2>
$${TMPOPTIONSFILE}"; \
=09status=3D$$?; \
=09if [ $${status} -ne 0 ] ; then \
=09=09${RM} -f $${TMPOPTIONSFILE}; \
=09=09${ECHO_MSG} "=3D=3D=3D> Options unchanged"; \
=09=09exit 0; \
=09fi; \
=09if [ ! -e ${TMPOPTIONSFILE} ]; then \
=09=09${ECHO_MSG} "=3D=3D=3D> No user-specified options to save for ${PKGNA=
ME}"; \
=09=09exit 0; \
=09fi; \
=09SELOPTIONS=3D$$(${CAT} $${TMPOPTIONSFILE}); \
=09${RM} -f $${TMPOPTIONSFILE}; \
=09WITH_${PORTNAME}_${MNU}=3D${SELOPTIONS}
.endfor
.endif

NOTE: The above code doesn't set a default value, or check if the
TMPOPTIONSFILE is just a space or empty.

I haven't figured out how to handle sub-OPTIONS.

Scot
--
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?790a9fff0602280855r3d596be3v4b257e7ec4689203>