1if [ ! "$_PACKAGES_PACKAGES_SUBR" ]; then _PACKAGES_PACKAGES_SUBR=1 2# 3# Copyright (c) 2013 Devin Teske 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/share/packages/packages.subr 251355 2013-06-04 00:38:19Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." "$0" 34f_include $BSDCFG_SHARE/dialog.subr 35f_include $BSDCFG_SHARE/strings.subr --- 32 unchanged lines hidden (view full) --- 68# 69# NOTE: The reason `eval' is recommended/shown for the syntax above is because 70# the $CATEGORY_MENU_LIST generated by f_index_read() is meant to be expanded 71# prior to execution (it contains a series of pre-quoted strings which act as 72# the interpolated command arguments). 73# 74f_package_accent_category_menu() 75{ |
76 local var_to_set="$1" category cat desc help varcat menu_buf n |
77 shift 1 # var_to_set 78 while [ $# -gt 0 ]; do |
79 category="${1%\*}" desc="${2%%; *}" help="$3" |
80 shift 3 # cat/desc/help 81 |
82 cat="${category# }" # Trim lead space inserted by sort-method |
83 f_str2varname "$cat" varcat 84 85 # Add number of installed packages for this category (if any) 86 n=0 87 case "$cat" in 88 "$msg_all") debug= f_getvar "_All_ninstalled" n ;; 89 *) debug= f_getvar "_${varcat}_ninstalled" n ;; 90 esac && 91 [ $n -ge 1 ] && desc="$desc; $n $msg_installed_lc" 92 93 # Add number of selected packages for this category (if any) 94 n=0 95 case "$cat" in 96 "$msg_all") debug= f_getvar "_All_nselected" n ;; 97 *) debug= f_getvar "_${varcat}_nselected" n ;; 98 esac && 99 [ $n -ge 1 ] && desc="$desc; $n $msg_selected" 100 101 # Re-Add asterisk to the category if its index has been cached |
102 f_isset _index_page_${varcat}_1 && category="$category*" |
103 104 # Update buffer with modified elements 105 menu_buf="$menu_buf |
106 '$category' '$desc' '$help'" # End-Quote |
107 done 108 setvar "$var_to_set" "$menu_buf" # return our buffer 109} 110 111# f_package_select $package ... 112# 113# Add $package to the list of tracked/selected packages. If $package is already 114# being tracked (already apears in $SELECTED_PACKAGES), this function amounts --- 669 unchanged lines hidden --- |