Which ports store/use OPTIONS (/var/db/ports/portname/options)?

Scot Hetzel swhetzel at gmail.com
Tue Feb 28 08:55:43 PST 2006


> > 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= OPTIONS CHKLST2
    OPTIONS_INPUT= USER GROUP
    OPTIONS_MENU= MNU1 MNU2

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

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

    OPTIONS_MNU1_TITLE="Choose a Database backend"
    OPTIONS_MNU1_OPTIONS= "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="What user do you want to run Apache as?"
    OPTIONS_GROUP_QUESTION="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}
	TMPOPTIONSFILE=$$(mktemp -t portmnuoptions); \
	trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
	${SH} -c "${DIALOG} --inputbox $${OPTIONS_${MNU}_QUESTION} 1 70 2>
$${TMPOPTIONSFILE}"; \
	status=$$?; \
	if [ $${status} -ne 0 ] ; then \
		${RM} -f $${TMPOPTIONSFILE}; \
		${ECHO_MSG} "===> Options unchanged"; \
		exit 0; \
	fi; \
	if [ ! -e ${TMPOPTIONSFILE} ]; then \
		${ECHO_MSG} "===> No user-specified options to save for ${PKGNAME}"; \
		exit 0; \
	fi; \
	SELOPTIONS=$$(${CAT} $${TMPOPTIONSFILE}); \
	${RM} -f $${TMPOPTIONSFILE}; \
	WITH_${PORTNAME}_${MNU}=${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.


More information about the freebsd-ports mailing list