head	1.28;
access;
symbols
	RELENG_9:1.26.0.2;
locks; strict;
comment	@# @;


1.28
date	2013.07.08.00.33.55;	author svnexp;	state Exp;
branches;
next	1.27;

1.27
date	2013.07.08.00.32.27;	author svnexp;	state Exp;
branches;
next	1.26;

1.26
date	2013.06.25.00.35.22;	author svnexp;	state Exp;
branches
	1.26.2.1;
next	1.25;

1.25
date	2013.06.21.00.26.22;	author svnexp;	state Exp;
branches;
next	1.24;

1.24
date	2013.06.19.00.55.08;	author svnexp;	state Exp;
branches;
next	1.23;

1.23
date	2013.06.03.00.53.59;	author svnexp;	state Exp;
branches;
next	1.22;

1.22
date	2013.06.03.00.44.56;	author svnexp;	state Exp;
branches;
next	1.21;

1.21
date	2013.06.03.00.43.28;	author svnexp;	state Exp;
branches;
next	1.20;

1.20
date	2013.06.03.00.32.49;	author svnexp;	state Exp;
branches;
next	1.19;

1.19
date	2013.06.02.00.37.30;	author svnexp;	state Exp;
branches;
next	1.18;

1.18
date	2013.06.01.00.35.21;	author svnexp;	state Exp;
branches;
next	1.17;

1.17
date	2013.05.15.00.26.05;	author svnexp;	state Exp;
branches;
next	1.16;

1.16
date	2013.05.08.00.27.54;	author svnexp;	state Exp;
branches;
next	1.15;

1.15
date	2013.04.27.00.46.12;	author svnexp;	state Exp;
branches;
next	1.14;

1.14
date	2013.04.23.00.30.01;	author svnexp;	state Exp;
branches;
next	1.13;

1.13
date	2013.04.23.00.27.07;	author svnexp;	state Exp;
branches;
next	1.12;

1.12
date	2013.01.15.00.52.23;	author svnexp;	state Exp;
branches;
next	1.11;

1.11
date	2013.01.15.00.26.49;	author svnexp;	state Exp;
branches;
next	1.10;

1.10
date	2012.12.25.11.03.38;	author svnexp;	state Exp;
branches;
next	1.9;

1.9
date	2012.12.25.09.37.00;	author svnexp;	state Exp;
branches;
next	1.8;

1.8
date	2012.11.17.04.41.47;	author svnexp;	state Exp;
branches;
next	1.7;

1.7
date	2012.11.17.01.54.39;	author svnexp;	state Exp;
branches;
next	1.6;

1.6
date	2012.09.22.04.04.02;	author dteske;	state Exp;
branches;
next	1.5;

1.5
date	2012.09.21.19.03.25;	author dteske;	state Exp;
branches;
next	1.4;

1.4
date	2012.09.21.01.36.20;	author dteske;	state Exp;
branches;
next	1.3;

1.3
date	2012.09.20.23.44.13;	author dteske;	state Exp;
branches;
next	1.2;

1.2
date	2012.09.18.22.28.42;	author dteske;	state Exp;
branches;
next	1.1;

1.1
date	2012.07.14.03.16.57;	author dteske;	state Exp;
branches;
next	;

1.26.2.1
date	2013.06.25.00.35.22;	author svnexp;	state dead;
branches;
next	1.26.2.2;

1.26.2.2
date	2013.07.07.20.03.18;	author svnexp;	state Exp;
branches;
next	1.26.2.3;

1.26.2.3
date	2014.03.27.04.02.36;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.28
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/252987
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@#!/bin/sh
#-
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 252987 2013-07-07 18:51:44Z dteske $
#
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr
f_include $BSDCFG_SHARE/sysrc.subr
f_include $BSDCFG_SHARE/startup/rcconf.subr

BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

############################################################ GLOBALS

#
# Global map/menu-list for the main menu
#
RCCONF_MAP=
RCCONF_MENU_LIST=

#
# Options
#
# Inherit SHOW_DESC value if set, otherwise default to 1
[ "${SHOW_DESC+set}" ] || SHOW_DESC=1
# Selectively inherit SHOW_* value (in order of preference)
if [ "$SHOW_DEFAULT_VALUE" ]; then
	SHOW_DEFAULT_VALUE=1
	SHOW_CONFIGURED=
	SHOW_VALUE=
elif [ "$SHOW_CONFIGURED" ]; then
	SHOW_DEFAULT_VALUE=
	SHOW_CONFIGURED=1
	SHOW_VALUE=
else
	SHOW_DEFAULT_VALUE=
	SHOW_CONFIGURED=
	SHOW_VALUE=1
fi

############################################################ FUNCTIONS

# dialog_create_main
#
# Create the dialog(1) main menu. Separated from dialog_menu_main (used to
# display the menu) to speed up execution (we only call this function when
# initializing or changing the view details).
#
dialog_create_main()
{
	# Show infobox for modes that take a while to calculate/display
	[ "$SHOW_DEFAULT_VALUE" -o "$SHOW_CONFIGURED" ] &&
		f_dialog_info "$msg_creating_menu_list"

	RCCONF_MENU_LIST=$(
		. "$RC_DEFAULTS" > /dev/null
		source_rc_confs > /dev/null
		var_list=$( f_startup_rcconf_list )
		for var in $var_list; do
			eval export $var
			[ "$SHOW_DEFAULT_VALUE" ] && export \
				_${var}_default="$( f_sysrc_get_default $var )"
			[ "$SHOW_CONFIGURED" ] && export \
				_${var}_file="$( f_sysrc_find $var )"
		done
		export SHOW_VALUE SHOW_DESC SHOW_DEFAULT_VALUE SHOW_CONFIGURED
		export msg_default_value
		echo "$var_list" | awk '
		BEGIN {
			prefix = ""
		}
		{
			cur_prefix = tolower(substr($1, 1, 1))
			printf "'\''"
			if ( prefix != cur_prefix )
				prefix = cur_prefix
			else
				printf " "
			var = $1
			printf "%s'\'' '\''[", var
			if ( ENVIRON["_" var "_delete"] )
				printf "X"
			else
				printf " "
			printf "] "
			if ( ENVIRON["SHOW_DEFAULT_VALUE"] ) {
				default = ENVIRON["_" var "_default"]
				gsub(/'\''/, "'\''\\'\'\''", default)
				value = ENVIRON[var]
				gsub(/'\''/, "'\''\\'\'\''", value)
				printf ENVIRON["msg_default_value"] "; %s",
				       default, value
			} else if ( ENVIRON["SHOW_CONFIGURED"] ) {
				printf "%s", ENVIRON["_" var "_file"]
			} else { # SHOW_VALUE (default behavior)
				value = ENVIRON[var]
				gsub(/'\''/, "'\''\\'\'\''", value)
				printf "%s", value
			}
			printf "'\''"
			if ( ENVIRON["SHOW_DESC"] ) {
				desc = ENVIRON["_" var "_desc"]
				gsub(/'\''/, "'\''\\'\'\''", desc)
				printf " '\''%s'\''", desc
			}
			printf "\n"
		}'
	)
}

# dialog_menu_main
#
# Display the dialog(1)-based application main menu.
#
dialog_menu_main()
{
	local prompt=
	local menu_list="
		'X $msg_exit_cancel'     '$msg_exit_cancel_desc'
		            ${SHOW_DESC:+'$msg_exit_cancel_help'}
		'> $msg_delete_selected' '$msg_delete_selected_desc'
		            ${SHOW_DESC:+'$msg_delete_selected_help'}
		'> $msg_all'             '$msg_all_desc'
		            ${SHOW_DESC:+'$msg_all_help'}
		'> $msg_none'            '$msg_none_desc'
		            ${SHOW_DESC:+'$msg_none_help'}
	${USE_XDIALOG:+
		'> $msg_view_details'    '$msg_view_details_desc'
		            ${SHOW_DESC:+'$msg_view_details_help'}
	}
	" # END-QUOTE
	local defaultitem= # Calculated below
	local hline="$hline_arrows_tab_enter"

	#
	# [Re-]Accent the menu list before incorporating it
	#
	local rcconf_var details help menu_buf delete
	eval set -- $RCCONF_MENU_LIST
	while [ $# -gt 0 ]; do
		rcconf_var="$1" details="$2" delete=
		f_shell_escape "$details" details
		if [ "$SHOW_DESC" ]; then
			help="$3"
			f_shell_escape "$help" help
			shift 3 # rcconf_var/details/help
		else
			shift 2 # rcconf_var/details
		fi

		# Update mark
		f_getvar _${rcconf_var# }_delete delete
		if [ "$delete" ]; then
			details="[X]${details#???}"
		else
			details="[ ]${details#???}"
		fi

		# Update buffer with modified elements
		menu_buf="$menu_buf
		'$rcconf_var' '$details' ${SHOW_DESC:+'$help'}" # End-Quote
	done
	menu_list="$menu_list $menu_buf"

	set -f # set noglob because descriptions in the $menu_list may contain
	       # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)).
	       # This prevents dialog(1) from expanding wildcards in help line.

	local height width rows
	eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
		height width rows      \
		\"\$DIALOG_TITLE\"     \
		\"\$DIALOG_BACKTITLE\" \
		\"\$prompt\"           \
		\"\$hline\"            \
		$menu_list

	# Obtain default-item from previously stored selection
	f_dialog_default_fetch defaultitem

	local menu_choice
	menu_choice=$( eval $DIALOG \
		--title \"\$DIALOG_TITLE\"         \
		--backtitle \"\$DIALOG_BACKTITLE\" \
		--hline \"\$hline\"                \
		--keep-tite                        \
		--ok-label \"\$msg_ok\"            \
		--cancel-label \"\$msg_cancel\"    \
		--help-button                      \
		--help-label \"\$msg_details\"     \
		${SHOW_DESC:+--item-help}          \
		--default-item \"\$defaultitem\"   \
		--menu \"\$prompt\"                \
		$height $width $rows               \
		$menu_list                         \
		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
	)
	local retval=$?
	f_dialog_data_sanitize menu_choice
	f_dialog_menutag_store "$menu_choice"

	# Only update default-item on success
	[ $retval -eq 0 ] && f_dialog_default_store "$menu_choice"

	return $retval
}

# dialog_menu_confirm_delete $var1 [$var2 ...]
#
# Get the user's blessing to delete one or more variables. Returns success if
# (and only-if) the user confirms (does not press ESC or Cancel/NO). Does NOT
# return the user's menu-choice.
#
dialog_menu_confirm_delete()
{
	local prompt="$msg_are_you_sure_you_want_delete_the_following"
	local menu_list # Calculated below
	local hline="$hline_arrows_tab_enter"

	[ $# -ge 1 ] || return $FAILURE

	# If asked to delete only one variable, simply ask and return
	if [ $# -eq 1 ]; then
		f_noyes "$msg_are_you_sure_you_want_to_delete" "$1"
		return $?
	fi
	# Not reached unless requested to delete multiple variables

	# Generate a menu to cleanly display the variables to be deleted
	local var_list
	var_list=$( for var in $*; do echo "$var"; done | sort -u )
	menu_list=$(
		. "$RC_DEFAULTS"
		source_rc_confs
		echo "$var_list" | awk '
		BEGIN {
			prefix = ""
		}
		{
			cur_prefix = tolower(substr($1, 1, 1))
			printf "'\''"
			if ( prefix != cur_prefix )
				prefix = cur_prefix
			else
				printf " "
			var = $1
			printf "%s'\'' '\'\''\n", var
		}'
	)

	local height width rows
	eval f_dialog_menu_size height width rows \
	                        \"\$DIALOG_TITLE\"     \
	                        \"\$DIALOG_BACKTITLE\" \
	                        \"\$prompt\"           \
	                        \"\$hline\"            \
	                        $menu_list

	local defaultno="defaultno"
	[ "$USE_XDIALOG" ] && defaultno="default-no"

	eval $DIALOG \
		--title \"\$DIALOG_TITLE\"         \
		--backtitle \"\$DIALOG_BACKTITLE\" \
		--hline \"\$hline\"                \
		--$defaultno                       \
		--ok-label \"\$msg_ok\"            \
		--cancel-label \"\$msg_cancel\"    \
		--menu \"\$prompt\"                \
		$height $width $rows               \
		$menu_list                         \
		2> /dev/null

	# Menu choice ignored; status of above command returned
}

############################################################ MAIN

# Incorporate rc-file if it exists
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"

#
# Process command-line arguments
#
while getopts h$GETOPTS_STDARGS flag; do
	case "$flag" in
	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
	esac
done
shift $(( $OPTIND - 1 ))

#
# Initialize
#
f_dialog_title "$msg_delete_startup_directives"
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
f_mustberoot_init

# Genreate $RCCONF_MAP of `var desc ...' per-line (see share/rcconf.subr)
f_dialog_info "$msg_creating_rcconf_map"
f_startup_rcconf_map RCCONF_MAP

# Generate _${var}_desc variables from $RCCONF_MAP
f_startup_rcconf_map_expand RCCONF_MAP

# Generate RCCONF_MENU_LIST from $RCCONF_MAP
dialog_create_main

#
# Launch application main menu
#
while :; do
	dialog_menu_main
	retval=$?
	f_dialog_menutag_fetch mtag

	if [ "$USE_XDIALOG" ]; then
		case "$mtag" in "> $msg_view_details")
			f_dialog_input_view_details && dialog_create_main
			continue
		esac
	elif [ $retval -eq 2 ]; then
		# The ``Help'' button (labeled "Details") was pressed
		f_dialog_input_view_details && dialog_create_main
		continue
	fi

	[ $retval -eq 0 ] || f_die

	case "$mtag" in
	"X $msg_exit_cancel") break ;;
	"> $msg_delete_selected")
		delete_vars=
		for var in $( f_startup_rcconf_list ); do
			[ "$( eval echo \$_${var}_delete )" ] || continue
			delete_vars="$delete_vars${delete_vars:+ }$var"
		done
		if dialog_menu_confirm_delete $delete_vars; then
			f_dialog_title "$msg_info"
			f_dialog_info "$msg_deleting_selected_directives"
			f_dialog_title_restore
			for var in $delete_vars; do
				if ! err=$( f_sysrc_delete $var 2>&1 ); then
					f_dialog_msgbox "$err\n"
					break
				fi
			done
			dialog_create_main
		fi
		;;
	"> $msg_all")
		for var in $( f_startup_rcconf_list ); do
			setvar _${var}_delete 1
			export _${var}_delete
		done
		;;
	"> $msg_none")
		var_list=$( set | awk -F= "
			/$STARTUP_RCCONF_REGEX/ {
				if (\$1 ~ /^_[[:alpha:]_][[:alnum:]_]*_delete/)
					print \$1
			}"
		)
		[ "$var_list" ] && unset $var_list
		;;
	*) # Anything else is a variable to edit
		var="${mtag# }"

		# Toggle the state-variable and loop back to menu
		if f_isset _${var}_delete; then
			unset _${var}_delete
		else
			setvar _${var}_delete 1
			export _${var}_delete
		fi
	esac
done

exit $SUCCESS

################################################################################
# END
################################################################################
@


1.27
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/252980
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d16 1
a16 1
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE
d20 1
a20 1
# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 252980 2013-07-07 18:21:30Z dteske $
@


1.26
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/252178
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d4 1
a4 1
# All Rights Reserved.
d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 252178 2013-06-24 20:58:54Z dteske $
@


1.26.2.1
log
@file rcdelete was added on branch RELENG_9 on 2013-07-07 20:03:18 +0000
@
text
@d1 415
@


1.26.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/252995
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 415
#!/bin/sh
#-
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: stable/9/usr.sbin/bsdconfig/startup/rcdelete 252995 2013-07-07 19:13:34Z dteske $
#
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr
f_include $BSDCFG_SHARE/sysrc.subr
f_include $BSDCFG_SHARE/startup/rcconf.subr

BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

############################################################ GLOBALS

#
# Global map/menu-list for the main menu
#
RCCONF_MAP=
RCCONF_MENU_LIST=

#
# Options
#
# Inherit SHOW_DESC value if set, otherwise default to 1
[ "${SHOW_DESC+set}" ] || SHOW_DESC=1
# Selectively inherit SHOW_* value (in order of preference)
if [ "$SHOW_DEFAULT_VALUE" ]; then
	SHOW_DEFAULT_VALUE=1
	SHOW_CONFIGURED=
	SHOW_VALUE=
elif [ "$SHOW_CONFIGURED" ]; then
	SHOW_DEFAULT_VALUE=
	SHOW_CONFIGURED=1
	SHOW_VALUE=
else
	SHOW_DEFAULT_VALUE=
	SHOW_CONFIGURED=
	SHOW_VALUE=1
fi

############################################################ FUNCTIONS

# dialog_create_main
#
# Create the dialog(1) main menu. Separated from dialog_menu_main (used to
# display the menu) to speed up execution (we only call this function when
# initializing or changing the view details).
#
dialog_create_main()
{
	# Show infobox for modes that take a while to calculate/display
	[ "$SHOW_DEFAULT_VALUE" -o "$SHOW_CONFIGURED" ] &&
		f_dialog_info "$msg_creating_menu_list"

	RCCONF_MENU_LIST=$(
		. "$RC_DEFAULTS" > /dev/null
		source_rc_confs > /dev/null
		var_list=$( f_startup_rcconf_list )
		for var in $var_list; do
			eval export $var
			[ "$SHOW_DEFAULT_VALUE" ] && export \
				_${var}_default="$( f_sysrc_get_default $var )"
			[ "$SHOW_CONFIGURED" ] && export \
				_${var}_file="$( f_sysrc_find $var )"
		done
		export SHOW_VALUE SHOW_DESC SHOW_DEFAULT_VALUE SHOW_CONFIGURED
		export msg_default_value
		echo "$var_list" | awk '
		BEGIN {
			prefix = ""
		}
		{
			cur_prefix = tolower(substr($1, 1, 1))
			printf "'\''"
			if ( prefix != cur_prefix )
				prefix = cur_prefix
			else
				printf " "
			var = $1
			printf "%s'\'' '\''[", var
			if ( ENVIRON["_" var "_delete"] )
				printf "X"
			else
				printf " "
			printf "] "
			if ( ENVIRON["SHOW_DEFAULT_VALUE"] ) {
				default = ENVIRON["_" var "_default"]
				gsub(/'\''/, "'\''\\'\'\''", default)
				value = ENVIRON[var]
				gsub(/'\''/, "'\''\\'\'\''", value)
				printf ENVIRON["msg_default_value"] "; %s",
				       default, value
			} else if ( ENVIRON["SHOW_CONFIGURED"] ) {
				printf "%s", ENVIRON["_" var "_file"]
			} else { # SHOW_VALUE (default behavior)
				value = ENVIRON[var]
				gsub(/'\''/, "'\''\\'\'\''", value)
				printf "%s", value
			}
			printf "'\''"
			if ( ENVIRON["SHOW_DESC"] ) {
				desc = ENVIRON["_" var "_desc"]
				gsub(/'\''/, "'\''\\'\'\''", desc)
				printf " '\''%s'\''", desc
			}
			printf "\n"
		}'
	)
}

# dialog_menu_main
#
# Display the dialog(1)-based application main menu.
#
dialog_menu_main()
{
	local prompt=
	local menu_list="
		'X $msg_exit_cancel'     '$msg_exit_cancel_desc'
		            ${SHOW_DESC:+'$msg_exit_cancel_help'}
		'> $msg_delete_selected' '$msg_delete_selected_desc'
		            ${SHOW_DESC:+'$msg_delete_selected_help'}
		'> $msg_all'             '$msg_all_desc'
		            ${SHOW_DESC:+'$msg_all_help'}
		'> $msg_none'            '$msg_none_desc'
		            ${SHOW_DESC:+'$msg_none_help'}
	${USE_XDIALOG:+
		'> $msg_view_details'    '$msg_view_details_desc'
		            ${SHOW_DESC:+'$msg_view_details_help'}
	}
	" # END-QUOTE
	local defaultitem= # Calculated below
	local hline="$hline_arrows_tab_enter"

	#
	# [Re-]Accent the menu list before incorporating it
	#
	local rcconf_var details help menu_buf delete
	eval set -- $RCCONF_MENU_LIST
	while [ $# -gt 0 ]; do
		rcconf_var="$1" details="$2" delete=
		f_shell_escape "$details" details
		if [ "$SHOW_DESC" ]; then
			help="$3"
			f_shell_escape "$help" help
			shift 3 # rcconf_var/details/help
		else
			shift 2 # rcconf_var/details
		fi

		# Update mark
		f_getvar _${rcconf_var# }_delete delete
		if [ "$delete" ]; then
			details="[X]${details#???}"
		else
			details="[ ]${details#???}"
		fi

		# Update buffer with modified elements
		menu_buf="$menu_buf
		'$rcconf_var' '$details' ${SHOW_DESC:+'$help'}" # End-Quote
	done
	menu_list="$menu_list $menu_buf"

	set -f # set noglob because descriptions in the $menu_list may contain
	       # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)).
	       # This prevents dialog(1) from expanding wildcards in help line.

	local height width rows
	eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
		height width rows      \
		\"\$DIALOG_TITLE\"     \
		\"\$DIALOG_BACKTITLE\" \
		\"\$prompt\"           \
		\"\$hline\"            \
		$menu_list

	# Obtain default-item from previously stored selection
	f_dialog_default_fetch defaultitem

	local menu_choice
	menu_choice=$( eval $DIALOG \
		--title \"\$DIALOG_TITLE\"         \
		--backtitle \"\$DIALOG_BACKTITLE\" \
		--hline \"\$hline\"                \
		--keep-tite                        \
		--ok-label \"\$msg_ok\"            \
		--cancel-label \"\$msg_cancel\"    \
		--help-button                      \
		--help-label \"\$msg_details\"     \
		${SHOW_DESC:+--item-help}          \
		--default-item \"\$defaultitem\"   \
		--menu \"\$prompt\"                \
		$height $width $rows               \
		$menu_list                         \
		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
	)
	local retval=$?
	f_dialog_data_sanitize menu_choice
	f_dialog_menutag_store "$menu_choice"

	# Only update default-item on success
	[ $retval -eq 0 ] && f_dialog_default_store "$menu_choice"

	return $retval
}

# dialog_menu_confirm_delete $var1 [$var2 ...]
#
# Get the user's blessing to delete one or more variables. Returns success if
# (and only-if) the user confirms (does not press ESC or Cancel/NO). Does NOT
# return the user's menu-choice.
#
dialog_menu_confirm_delete()
{
	local prompt="$msg_are_you_sure_you_want_delete_the_following"
	local menu_list # Calculated below
	local hline="$hline_arrows_tab_enter"

	[ $# -ge 1 ] || return $FAILURE

	# If asked to delete only one variable, simply ask and return
	if [ $# -eq 1 ]; then
		f_noyes "$msg_are_you_sure_you_want_to_delete" "$1"
		return $?
	fi
	# Not reached unless requested to delete multiple variables

	# Generate a menu to cleanly display the variables to be deleted
	local var_list
	var_list=$( for var in $*; do echo "$var"; done | sort -u )
	menu_list=$(
		. "$RC_DEFAULTS"
		source_rc_confs
		echo "$var_list" | awk '
		BEGIN {
			prefix = ""
		}
		{
			cur_prefix = tolower(substr($1, 1, 1))
			printf "'\''"
			if ( prefix != cur_prefix )
				prefix = cur_prefix
			else
				printf " "
			var = $1
			printf "%s'\'' '\'\''\n", var
		}'
	)

	local height width rows
	eval f_dialog_menu_size height width rows \
	                        \"\$DIALOG_TITLE\"     \
	                        \"\$DIALOG_BACKTITLE\" \
	                        \"\$prompt\"           \
	                        \"\$hline\"            \
	                        $menu_list

	local defaultno="defaultno"
	[ "$USE_XDIALOG" ] && defaultno="default-no"

	eval $DIALOG \
		--title \"\$DIALOG_TITLE\"         \
		--backtitle \"\$DIALOG_BACKTITLE\" \
		--hline \"\$hline\"                \
		--$defaultno                       \
		--ok-label \"\$msg_ok\"            \
		--cancel-label \"\$msg_cancel\"    \
		--menu \"\$prompt\"                \
		$height $width $rows               \
		$menu_list                         \
		2> /dev/null

	# Menu choice ignored; status of above command returned
}

############################################################ MAIN

# Incorporate rc-file if it exists
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"

#
# Process command-line arguments
#
while getopts h$GETOPTS_STDARGS flag; do
	case "$flag" in
	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
	esac
done
shift $(( $OPTIND - 1 ))

#
# Initialize
#
f_dialog_title "$msg_delete_startup_directives"
f_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
f_mustberoot_init

# Genreate $RCCONF_MAP of `var desc ...' per-line (see share/rcconf.subr)
f_dialog_info "$msg_creating_rcconf_map"
f_startup_rcconf_map RCCONF_MAP

# Generate _${var}_desc variables from $RCCONF_MAP
f_startup_rcconf_map_expand RCCONF_MAP

# Generate RCCONF_MENU_LIST from $RCCONF_MAP
dialog_create_main

#
# Launch application main menu
#
while :; do
	dialog_menu_main
	retval=$?
	f_dialog_menutag_fetch mtag

	if [ "$USE_XDIALOG" ]; then
		case "$mtag" in "> $msg_view_details")
			f_dialog_input_view_details && dialog_create_main
			continue
		esac
	elif [ $retval -eq 2 ]; then
		# The ``Help'' button (labeled "Details") was pressed
		f_dialog_input_view_details && dialog_create_main
		continue
	fi

	[ $retval -eq 0 ] || f_die

	case "$mtag" in
	"X $msg_exit_cancel") break ;;
	"> $msg_delete_selected")
		delete_vars=
		for var in $( f_startup_rcconf_list ); do
			[ "$( eval echo \$_${var}_delete )" ] || continue
			delete_vars="$delete_vars${delete_vars:+ }$var"
		done
		if dialog_menu_confirm_delete $delete_vars; then
			f_dialog_title "$msg_info"
			f_dialog_info "$msg_deleting_selected_directives"
			f_dialog_title_restore
			for var in $delete_vars; do
				if ! err=$( f_sysrc_delete $var 2>&1 ); then
					f_dialog_msgbox "$err\n"
					break
				fi
			done
			dialog_create_main
		fi
		;;
	"> $msg_all")
		for var in $( f_startup_rcconf_list ); do
			setvar _${var}_delete 1
			export _${var}_delete
		done
		;;
	"> $msg_none")
		var_list=$( set | awk -F= "
			/$STARTUP_RCCONF_REGEX/ {
				if (\$1 ~ /^_[[:alpha:]_][[:alnum:]_]*_delete/)
					print \$1
			}"
		)
		[ "$var_list" ] && unset $var_list
		;;
	*) # Anything else is a variable to edit
		var="${mtag# }"

		# Toggle the state-variable and loop back to menu
		if f_isset _${var}_delete; then
			unset _${var}_delete
		else
			setvar _${var}_delete 1
			export _${var}_delete
		fi
	esac
done

exit $SUCCESS

################################################################################
# END
################################################################################
@


1.26.2.3
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/263791
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: stable/9/usr.sbin/bsdconfig/startup/rcdelete 263791 2014-03-27 03:20:47Z dteske $
d42 2
a43 2
f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
	pgm="${ipgm:-$pgm}"
d235 1
a235 1
	[ $retval -eq $DIALOG_OK ] && f_dialog_default_store "$menu_choice"
d252 1
a252 1
	[ $# -ge 1 ] || return $DIALOG_CANCEL
d354 1
a354 1
	elif [ $retval -eq $DIALOG_HELP ]; then
d360 1
a360 1
	[ $retval -eq $DIALOG_OK ] || f_die
d367 2
a368 3
			f_getvar _${var}_delete _delete
			[ "$_delete" ] || continue
			delete_vars="$delete_vars $var"
d375 4
a378 2
				f_eval_catch "$0" f_sysrc_delete \
					'f_sysrc_delete "%s"' "$var" || break
@


1.25
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/252018
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 252018 2013-06-20 05:42:21Z dteske $
d319 1
a319 1
	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
@


1.24
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251965
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 251965 2013-06-18 21:35:38Z dteske $
a369 1
		unset var # no longer needed
d375 1
a375 2
				err=$( f_sysrc_delete $var 2>&1 )
				if [ $? -ne $SUCCESS ]; then
a379 1
			unset var # no longer needed
a387 1
		unset var # no longer needed
a396 1
		unset var_list # no longer needed
a407 1
		unset var # no longer needed
@


1.23
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251277
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 251277 2013-06-02 23:23:29Z dteske $
d341 3
@


1.22
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251266
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 251266 2013-06-02 22:34:40Z dteske $
d256 1
a256 1
		f_noyes "$msg_are_you_sure_you_want_to_delete" "$delete_vars"
@


1.21
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251264
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 251264 2013-06-02 20:02:50Z dteske $
d197 3
a199 1
	set -f # noglob (descriptions in $RCCONF_MENU_LIST may contain *)
d254 1
d259 1
d261 1
@


1.20
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251244
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 251244 2013-06-02 09:02:12Z dteske $
d149 16
a165 2
	local prompt=""
	local defaultitem= # Calculated below
d195 1
a195 16

	local menu_list="
		'X $msg_exit_cancel'     '$msg_exit_cancel_desc'
		            ${SHOW_DESC:+'$msg_exit_cancel_help'}
		'> $msg_delete_selected' '$msg_delete_selected_desc'
		            ${SHOW_DESC:+'$msg_delete_selected_help'}
		'> $msg_all'             '$msg_all_desc'
		            ${SHOW_DESC:+'$msg_all_help'}
		'> $msg_none'            '$msg_none_desc'
		            ${SHOW_DESC:+'$msg_none_help'}
	${USE_XDIALOG:+
		'> $msg_view_details'    '$msg_view_details_desc'
		            ${SHOW_DESC:+'$msg_view_details_help'}
	}
		$menu_buf
	" # END-QUOTE
d246 2
a248 2
	local prompt="$msg_are_you_sure_you_want_delete_the_following"
	local var_list menu_list
d257 1
@


1.19
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251236
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 251236 2013-06-01 23:58:44Z dteske $
d151 1
d209 3
d214 13
a226 13
		--title \"\$DIALOG_TITLE\"          \
		--backtitle \"\$DIALOG_BACKTITLE\"  \
		--hline \"\$hline\"                 \
		--keep-tite                         \
		--ok-label \"\$msg_ok\"             \
		--cancel-label \"\$msg_cancel\"     \
		--help-button                       \
		--help-label \"\$msg_details\"      \
		${SHOW_DESC:+--item-help}           \
		--default-item \"\$DEFAULTITEM_$$\" \
		--menu \"\$prompt\"                 \
		$height $width $rows                \
		$menu_list                          \
d234 1
a234 1
	[ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$menu_choice"
@


1.18
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251190
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 251190 2013-05-31 19:07:17Z dteske $
d208 2
a209 2
	local dialog_menu
	dialog_menu=$( eval $DIALOG \
d226 2
a227 1
	setvar DIALOG_MENU_$$ "$dialog_menu"
d230 1
a230 1
	[ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$dialog_menu"
d335 1
a335 1
	mtag=$( f_dialog_menutag )
@


1.17
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250633
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 250633 2013-05-14 03:21:13Z dteske $
a148 1
	local size
d199 8
a206 6
	size=$( eval f_dialog_menu_${SHOW_DESC:+with_help_}size \
	        	\"\$DIALOG_TITLE\"     \
	        	\"\$DIALOG_BACKTITLE\" \
	                \"\$prompt\"           \
	        	\"\$hline\"            \
	        	$menu_list             )
d220 2
a221 1
		--menu \"\$prompt\" $size           \
a241 1
	local size
d273 7
a279 6
	size=$( eval f_dialog_menu_size \
	        	\"\$DIALOG_TITLE\"     \
	        	\"\$DIALOG_BACKTITLE\" \
	                \"\$prompt\"           \
	        	\"\$hline\"            \
	        	$menu_list             )
d291 2
a292 1
		--menu \"\$prompt\" $size          \
@


1.16
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250317
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 250317 2013-05-07 03:57:45Z dteske $
d304 1
a304 1
while getopts dD:hSX flag; do
@


1.15
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/249954
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 249954 2013-04-26 21:19:05Z dteske $
d391 1
a391 1
		if eval [ \"\${_${var}_delete+set}\" ]; then
@


1.14
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/249751
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 249751 2013-04-22 05:52:06Z dteske $
d292 2
@


1.13
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/249746
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 249746 2013-04-22 05:02:34Z dteske $
a50 1
_RCCONF_MAP=
d75 1
a75 1
# dialog_menu_main
d77 3
a79 1
# Display the dialog(1)-based application main menu.
d81 1
a81 1
dialog_menu_main()
a82 29
	local size
	local hline="$hline_arrows_tab_enter"
	local prompt=""

	RCCONF_MENU_LIST="
		'X $msg_exit_cancel'     '$msg_exit_cancel_desc'
		            ${SHOW_DESC:+'$msg_exit_cancel_help'}
		'> $msg_delete_selected' '$msg_delete_selected_desc'
		            ${SHOW_DESC:+'$msg_delete_selected_help'}
		'> $msg_all'             '$msg_all_desc'
		            ${SHOW_DESC:+'$msg_all_help'}
		'> $msg_none'            '$msg_none_desc'
		            ${SHOW_DESC:+'$msg_none_help'}
	${USE_XDIALOG:+
		'> $msg_view_details' '$msg_view_details_desc'
		                       ${SHOW_DESC:+'$msg_view_details_help'}
	}
	" # END-QUOTE

	if [ ! "$_RCCONF_MAP" ]; then
		# Genreate RCCONF_MAP of `var desc ...' per-line
		f_dialog_info "$msg_creating_rcconf_map"
		RCCONF_MAP=$( f_startup_rcconf_map )
		export RCCONF_MAP
		# Generate _${var}_desc variables from $RCCONF_MAP
		f_startup_rcconf_map_expand
		export _RCCONF_MAP=1
	fi

d87 1
a87 1
	RCCONF_MENU_LIST="$RCCONF_MENU_LIST $(
d140 57
a196 1
	)"
d198 1
a198 1
	set -f # noglob
d205 1
a205 1
	        	$RCCONF_MENU_LIST      )
d209 12
a220 10
		--clear --title \"\$DIALOG_TITLE\" \
		--backtitle \"\$DIALOG_BACKTITLE\" \
		--hline \"\$hline\"                \
		--ok-label \"\$msg_ok\"            \
		--cancel-label \"\$msg_cancel\"    \
		--help-button                      \
		--help-label \"\$msg_details\"     \
		${SHOW_DESC:+--item-help}          \
		--menu \"\$prompt\" $size          \
		$RCCONF_MENU_LIST                  \
d225 4
d232 1
a232 1
# dialog_menu_delete $var1 [$var2 ...]
d234 3
a236 2
# Get the user's blessing to delete one or more variables.
# if (and only-if) the user confirms (does not press ESC or Cancel/NO).
d238 1
a238 1
dialog_menu_delete()
d282 2
a283 3
	local dialog_menu
	dialog_menu=$( eval $DIALOG \
		--clear --title \"\$DIALOG_TITLE\" \
d291 1
a291 5
		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
	)
	local retval=$?
	setvar DIALOG_MENU_$$ "$dialog_menu"
	return $retval
d316 10
d332 2
a333 3
		case "$mtag" in
		"> $msg_view_details")
			f_dialog_input_view_details
d338 1
a338 1
		f_dialog_input_view_details
d353 1
a353 1
		if dialog_menu_delete $delete_vars; then
d365 1
@


1.12
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/245437
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d3 1
a3 1
# Copyright (c) 2012 Devin Teske
d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 245437 2013-01-14 21:03:34Z dteske $
d272 1
a272 1
while getopts hSX flag; do
@


1.11
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/245402
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 245402 2013-01-14 01:15:25Z dteske $
d321 1
a321 1
					f_show_msg "%s\n" "$err"
@


1.10
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/244675
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 244675 2012-12-25 10:47:45Z dteske $
d213 1
a213 3
		msg=$( printf "$msg_are_you_sure_you_want_to_delete" \
		              "$delete_vars" )
		f_dialog_noyes "$msg"
@


1.9
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/244674
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 244674 2012-12-25 09:30:25Z dteske $
d33 1
@


1.8
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/243112
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r243112 | dteske | 2012-11-16 00:59:11 +0000 (Fri, 16 Nov 2012) | 11 lines
## SVN ##
## SVN ## Replicate a feature from sysinstall documented in
## SVN ## stable/9/usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## To get a list of modules you can link to, see `bsdconfig -h' output.
## SVN ##
## SVN ## Approved by:	adrian (co-mentor) (implicit)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 243112 2012-11-16 00:59:11Z dteske $
a282 1
f_dialog_init
@


1.7
log
@Switching exporter and resync
@
text
@d27 1
a27 1
# $FreeBSD: head/usr.sbin/bsdconfig/startup/rcdelete 240798 2012-09-22 04:04:02Z dteske $
d41 1
a41 1
ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
@


1.6
log
@SVN rev 240798 on 2012-09-22 04:04:02Z by dteske

Replace "( : ${var?} )" syntax with better "[ ${var+set} ]" syntax.

Reviewed by:	jilles, adrian (co-mentor)
Approved by:	jilles, adrian (co-mentor)
@
text
@d27 1
a27 1
# $FreeBSD$
@


1.5
log
@SVN rev 240783 on 2012-09-21 19:03:25Z by dteske

Reverse SVN r240770 -- jilles@@ made a suggestion that allowed us to redesign
our embedded rescue environment to support /dev/null making r240770 obsolete.

Reviewed by:	jilles, adrian (co-mentor)
Approved by:	jilles, adrian (co-mentor)
@
text
@d57 1
a57 1
( : ${SHOW_DESC?} ) > /dev/null 2>&1 || SHOW_DESC=1
d351 1
a351 1
		if ( eval : \${_${var}_delete?} ) > /dev/null 2>&1; then
@


1.4
log
@SVN rev 240770 on 2012-09-21 01:36:20Z by dteske

Replace redirections to /dev/null with "close file-descriptor" syntax (>&-).

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
@
text
@d57 1
a57 1
( : ${SHOW_DESC?} ) >&- 2>&- || SHOW_DESC=1
d115 2
a116 2
		. "$RC_DEFAULTS" >&-
		source_rc_confs >&-
d351 1
a351 1
		if ( eval : \${_${var}_delete?} ) >&- 2>&-; then
@


1.3
log
@SVN rev 240768 on 2012-09-20 23:44:13Z by dteske

Change all invocations of dialog(1) to no-longer require temporary files.
This allows bsdconfig to -- like bsdinstall -- operate from read-only media.

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
@
text
@d57 1
a57 1
( : ${SHOW_DESC?} ) > /dev/null 2>&1 || SHOW_DESC=1
d115 2
a116 2
		. "$RC_DEFAULTS" > /dev/null
		source_rc_confs > /dev/null
d351 1
a351 1
		if ( eval : \${_${var}_delete?} ) > /dev/null 2>&1; then
@


1.2
log
@SVN rev 240684 on 2012-09-18 22:28:42Z by dteske

Move major includes into /usr/share/bsdconfig for easy external access.

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
@
text
@d178 2
a179 1
	eval $DIALOG \
d190 5
a194 1
		2> "$DIALOG_TMPDIR/dialog.menu.$$"
d248 2
a249 1
	eval $DIALOG \
d258 5
a262 1
		2> "$DIALOG_TMPDIR/dialog.menu.$$"
@


1.1
log
@SVN rev 238438 on 2012-07-14 03:16:57Z by dteske

Import bsdconfig(8) as a replacement for the post-install abilities of
deprecated sysinstall(8). NOTE: WITH_BSDCONFIG is currently required.

Submitted by:	Devin Teske (dteske), Ron McDowell <rcm@@fuzzwad.org>
Reviewed by:	Ron McDowell <rcm@@fuzzwad.org>
Approved by:	Ed Maste (emaste)
@
text
@d31 6
a36 5
BSDCFG_LIBE="/usr/libexec/bsdconfig"
. $BSDCFG_LIBE/include/common.subr || exit 1
f_include $BSDCFG_LIBE/include/dialog.subr
f_include $BSDCFG_LIBE/include/mustberoot.subr
f_include $BSDCFG_LIBE/include/sysrc.subr
d38 1
a38 2
APP_DIR="140.startup"
f_include $BSDCFG_LIBE/$APP_DIR/include/rcconf.subr
@

