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 250538 2013-05-12 00:46:18Z 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 --- 37 unchanged lines hidden (view full) --- 73# 74f_package_accent_category_menu() 75{ 76 local var_to_set="$1" cat desc help varcat menu_buf n 77 shift 1 # var_to_set 78 while [ $# -gt 0 ]; do 79 cat="${1%\*}" desc="${2%%; *}" help="$3" 80 shift 3 # cat/desc/help |
81 |
82 cat="${cat# }" # Trim leading 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 # Add an asterisk to the category if its index has been cached 102 f_isset _index_page_${varcat}_1 && cat="$cat*" 103 |
104 # Update buffer with modified elements 105 menu_buf="$menu_buf 106 '$cat' '$desc' '$help'" # End-Quote 107 done 108 setvar "$var_to_set" "$menu_buf" # return our buffer 109} 110 111# f_package_select $package ... --- 256 unchanged lines hidden (view full) --- 368 369 f_isinteger "$page" || return $FAILURE 370 371 f_str2varname "$category" varcat 372 f_package_index_get_page "$category" $page index_page 373 374 # Get number of packages for this category 375 case "$category" in |
376 "$msg_all"|"") npkgs="${_npkgs:-0}";; |
377 *) f_getvar _npkgs_$varcat npkgs 378 esac 379 380 # Calculate number of pages 381 npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE )) 382 383 # Add a page to the pagecount if not evenly divisible 384 [ $(( $npages * $PACKAGE_MENU_PAGESIZE )) -lt $npkgs ] && --- 55 unchanged lines hidden (view full) --- 440 printf "\n" 441 }' 442 ) 443 ${add_prev:+'> $previous_page' '' ${SHOW_DESC:+''}} 444 ${add_next:+'> $next_page' '' ${SHOW_DESC:+''}} 445 " # End-Quote 446 447 local prompt="" |
448 # Accept/Translate i18n "All" but other category names must 449 # match tree definitions from INDEX, ports, FTP, etc. 450 case "$category" in 451 "$msg_all"|"") f_category_desc_get "All" prompt ;; 452 *) f_category_desc_get "$category" prompt ;; 453 esac |
454 prompt="$prompt $( printf "$msg_page_of_npages" \ 455 "$page" "$npages" )" 456 457 local hline="$hline_arrows_tab_punc_enter" 458 local size isize dialog_menu item 459 size=$( eval f_dialog_menu${SHOW_DESC:+_with_help}_size \ 460 \"\$DIALOG_TITLE\" \ 461 \"\$DIALOG_BACKTITLE\" \ --- 298 unchanged lines hidden --- |