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 251232 2013-06-01 21:29:53Z 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 --- 256 unchanged lines hidden (view full) --- 292 local prompt="$msg_please_select_a_category_to_display" 293 local hline="" 294 295 menu_list=" 296 '> $msg_review' '$msg_review_desc' '$msg_review_help' 297 $category_list 298 " # End-Quote 299 |
300 local height width rows dialog_menu 301 eval f_dialog_menu_with_help_size height width rows \ 302 \"\$DIALOG_TITLE\" \ 303 \"\$DIALOG_BACKTITLE\" \ 304 \"\$prompt\" \ 305 \"\$hline\" \ 306 $menu_list |
307 dialog_menu=$( eval $DIALOG \ 308 --title \"\$DIALOG_TITLE\" \ 309 --backtitle \"\$DIALOG_BACKTITLE\" \ 310 --hline \"\$hline\" \ 311 --item-help \ 312 --default-item \"\$defaultitem\" \ 313 --ok-label \"$msg_select\" \ 314 --cancel-label \"$msg_cancel\" \ |
315 --menu \"\$prompt\" \ 316 $height $width $rows \ |
317 $menu_list \ 318 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 319 ) 320 local retval=$? 321 setvar DIALOG_MENU_$$ "$dialog_menu" 322 return $retval 323} 324 --- 126 unchanged lines hidden (view full) --- 451 case "$category" in 452 "$msg_all"|"") f_category_desc_get "All" prompt ;; 453 *) f_category_desc_get "$category" prompt ;; 454 esac 455 prompt="$prompt $( printf "$msg_page_of_npages" \ 456 "$page" "$npages" )" 457 458 local hline="$hline_arrows_tab_punc_enter" |
459 local mheight mwidth mrows 460 f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \ 461 \"\$DIALOG_TITLE\" \"\$DIALOG_BACKTITLE\" \ 462 \"\$prompt\" \"\$hline\" $menu_list 463 local iheight iwidth 464 f_dialog_infobox_size iheight iwidth \ 465 "$DIALOG_TITLE" "$DIALOG_BACKTITLE" \ 466 "$msg_processing_selection" 467 local dialog_menu item |
468 dialog_menu=$( eval $DIALOG \ 469 --title \"\$DIALOG_TITLE\" \ 470 --backtitle \"\$DIALOG_BACKTITLE\" \ 471 --hline \"\$hline\" \ 472 --keep-tite \ 473 --ok-label \"$msg_select\" \ 474 --cancel-label \"$msg_back\" \ 475 ${SHOW_DESC:+--item-help} \ 476 --default-item \"\$defaultitem\" \ |
477 --menu \"\$prompt\" \ 478 $mheight $mwidth $mrows \ |
479 $menu_list \ 480 --and-widget \ 481 ${USE_XDIALOG:+--no-buttons} \ |
482 --infobox \"\$msg_processing_selection\" \ 483 $iheight $iwidth \ |
484 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 485 ) 486 local retval=$? 487 setvar DIALOG_MENU_$$ "$dialog_menu" 488 489 if [ $retval -eq $SUCCESS ]; then 490 item=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \ 491 \"\$dialog_menu\" $menu_list ) --- 8 unchanged lines hidden (view full) --- 500# Display a menu, asking the user what they would like to do with $package 501# with regard to "deselecting" an already installed package. Choices include 502# uninstall, re-install, or cancel (leave $package marked as installed). 503# Returns success if the user does not press ESC or choose Cnacel. Use the 504# f_dialog_menutag() function upon success to retrieve the user's choice. 505# 506f_package_menu_deselect() 507{ |
508 local package="$1" prompt menu_list dialog_menu |
509 prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" ) 510 local hline="$hline_alnum_arrows_punc_tab_enter" 511 menu_list=" 512 'X $msg_installed' '$msg_installed_desc' 513 'R $msg_reinstall' '$msg_reinstall_desc' 514 'U $msg_uninstall' '$msg_uninstall_desc' 515 " # End-Quote |
516 517 local height width rows 518 eval f_dialog_menu_size height width rows \ 519 \"\$DIALOG_TITLE\" \ 520 \"\$DIALOG_BACKTITLE\" \ 521 \"\$prompt\" \ 522 \"\$hline\" \ 523 $menu_list 524 |
525 dialog_menu=$( eval $DIALOG \ 526 --title \"\$DIALOG_TITLE\" \ 527 --backtitle \"\$DIALOG_BACKTITLE\" \ 528 --hline \"\$hline\" \ 529 --ok-label \"$msg_select\" \ 530 --cancel-label \"$msg_cancel\" \ |
531 --menu \"\$prompt\" \ 532 $height $width $rows \ |
533 $menu_list \ 534 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 535 ) 536 local retval=$? 537 setvar DIALOG_MENU_$$ "$dialog_menu" 538 return $retval 539} 540 541# f_package_review 542# 543# Display a review screen, showing selected packages and what they are marked 544# for, before proceeding (if the user does not press ESC or choose Cancel) to 545# operate on each selection. Returns error if no packages have been selected, 546# or the user has pressed ESC, or if they have chosen Cancel. 547# 548f_package_review() 549{ |
550 local prompt dialog_menu package varpkg mark menu_list= |
551 prompt=$( printf "$msg_reviewing_selected_packages" \ 552 "$_All_nselected" ) 553 local hline="$hline_alnum_arrows_punc_tab_enter" 554 f_dprintf "f_package_review: SELECTED_PACKAGES=[%s]" \ 555 "$SELECTED_PACKAGES" 556 for package in $SELECTED_PACKAGES; do 557 mark= 558 f_str2varname "$package" varpkg 559 f_getvar _mark_$varpkg mark 560 [ "$mark" -a ! "${mark#[IRUD]}" ] || continue 561 menu_list="$menu_list 562 '$mark' '$package' 563 " # End-Quote 564 done 565 if [ ! "$menu_list" ]; then 566 f_show_msg "$msg_no_packages_were_selected_for_extraction" 567 return $FAILURE # They might have selected this by accident 568 fi 569 menu_list=$( echo "$menu_list" | sort ) |
570 571 local height width rows 572 eval f_dialog_menu_size height width rows \ 573 \"\$DIALOG_TITLE\" \ 574 \"\$DIALOG_BACKTITLE\" \ 575 \"\$prompt\" \ 576 \"\$hline\" \ 577 $menu_list 578 |
579 dialog_menu=$( eval $DIALOG \ 580 --title \"\$DIALOG_TITLE\" \ 581 --backtitle \"\$DIALOG_BACKTITLE\" \ 582 --hline \"\$hline\" \ 583 --ok-label \"\$msg_proceed\" \ 584 --cancel-label \"\$msg_cancel\" \ |
585 --menu \"\$prompt\" \ 586 $height $width $rows \ |
587 $menu_list \ 588 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 589 ) 590 local retval=$? 591 setvar DIALOG_MENU_$$ "$dialog_menu" 592 593 # 594 # XXX --- 174 unchanged lines hidden --- |