Deleted Added
full compact
packages.subr (250538) packages.subr (251232)
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#
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 $
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
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 size dialog_menu
301 size=$( eval f_dialog_menu_with_help_size \
302 \"\$DIALOG_TITLE\" \
303 \"\$DIALOG_BACKTITLE\" \
304 \"\$prompt\" \
305 \"\$hline\" \
306 $menu_list )
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\" \
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\" $size \
315 --menu \"\$prompt\" \
316 $height $width $rows \
316 $menu_list \
317 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
318 )
319 local retval=$?
320 setvar DIALOG_MENU_$$ "$dialog_menu"
321 return $retval
322}
323

--- 126 unchanged lines hidden (view full) ---

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"
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"
458 local size isize dialog_menu item
459 size=$( eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
460 \"\$DIALOG_TITLE\" \
461 \"\$DIALOG_BACKTITLE\" \
462 \"\$prompt\" \
463 \"\$hline\" \
464 $menu_list )
465 isize=$( f_dialog_infobox_size \
466 "$DIALOG_TITLE" \
467 "$DIALOG_BACKTITLE" \
468 "$msg_processing_selection" )
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
469 dialog_menu=$( eval $DIALOG \
470 --title \"\$DIALOG_TITLE\" \
471 --backtitle \"\$DIALOG_BACKTITLE\" \
472 --hline \"\$hline\" \
473 --keep-tite \
474 --ok-label \"$msg_select\" \
475 --cancel-label \"$msg_back\" \
476 ${SHOW_DESC:+--item-help} \
477 --default-item \"\$defaultitem\" \
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\" \
478 --menu \"\$prompt\" $size \
477 --menu \"\$prompt\" \
478 $mheight $mwidth $mrows \
479 $menu_list \
480 --and-widget \
481 ${USE_XDIALOG:+--no-buttons} \
479 $menu_list \
480 --and-widget \
481 ${USE_XDIALOG:+--no-buttons} \
482 --infobox \"\$msg_processing_selection\" $isize \
482 --infobox \"\$msg_processing_selection\" \
483 $iheight $iwidth \
483 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
484 )
485 local retval=$?
486 setvar DIALOG_MENU_$$ "$dialog_menu"
487
488 if [ $retval -eq $SUCCESS ]; then
489 item=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \
490 \"\$dialog_menu\" $menu_list )

--- 8 unchanged lines hidden (view full) ---

499# Display a menu, asking the user what they would like to do with $package
500# with regard to "deselecting" an already installed package. Choices include
501# uninstall, re-install, or cancel (leave $package marked as installed).
502# Returns success if the user does not press ESC or choose Cnacel. Use the
503# f_dialog_menutag() function upon success to retrieve the user's choice.
504#
505f_package_menu_deselect()
506{
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{
507 local package="$1" prompt menu_list size dialog_menu
508 local package="$1" prompt menu_list dialog_menu
508 prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" )
509 local hline="$hline_alnum_arrows_punc_tab_enter"
510 menu_list="
511 'X $msg_installed' '$msg_installed_desc'
512 'R $msg_reinstall' '$msg_reinstall_desc'
513 'U $msg_uninstall' '$msg_uninstall_desc'
514 " # End-Quote
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
515 size=$( eval f_dialog_menu_size \
516 \"\$DIALOG_TITLE\" \
517 \"\$DIALOG_BACKTITLE\" \
518 \"\$prompt\" \
519 \"\$hline\" \
520 $menu_list )
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
521 dialog_menu=$( eval $DIALOG \
522 --title \"\$DIALOG_TITLE\" \
523 --backtitle \"\$DIALOG_BACKTITLE\" \
524 --hline \"\$hline\" \
525 --ok-label \"$msg_select\" \
526 --cancel-label \"$msg_cancel\" \
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\" \
527 --menu \"\$prompt\" $size \
531 --menu \"\$prompt\" \
532 $height $width $rows \
528 $menu_list \
529 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
530 )
531 local retval=$?
532 setvar DIALOG_MENU_$$ "$dialog_menu"
533 return $retval
534}
535
536# f_package_review
537#
538# Display a review screen, showing selected packages and what they are marked
539# for, before proceeding (if the user does not press ESC or choose Cancel) to
540# operate on each selection. Returns error if no packages have been selected,
541# or the user has pressed ESC, or if they have chosen Cancel.
542#
543f_package_review()
544{
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{
545 local prompt size dialog_menu package varpkg mark menu_list=
550 local prompt dialog_menu package varpkg mark menu_list=
546 prompt=$( printf "$msg_reviewing_selected_packages" \
547 "$_All_nselected" )
548 local hline="$hline_alnum_arrows_punc_tab_enter"
549 f_dprintf "f_package_review: SELECTED_PACKAGES=[%s]" \
550 "$SELECTED_PACKAGES"
551 for package in $SELECTED_PACKAGES; do
552 mark=
553 f_str2varname "$package" varpkg
554 f_getvar _mark_$varpkg mark
555 [ "$mark" -a ! "${mark#[IRUD]}" ] || continue
556 menu_list="$menu_list
557 '$mark' '$package'
558 " # End-Quote
559 done
560 if [ ! "$menu_list" ]; then
561 f_show_msg "$msg_no_packages_were_selected_for_extraction"
562 return $FAILURE # They might have selected this by accident
563 fi
564 menu_list=$( echo "$menu_list" | sort )
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 )
565 size=$( eval f_dialog_menu_size \
566 \"\$DIALOG_TITLE\" \
567 \"\$DIALOG_BACKTITLE\" \
568 \"\$prompt\" \
569 \"\$hline\" \
570 $menu_list )
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
571 dialog_menu=$( eval $DIALOG \
572 --title \"\$DIALOG_TITLE\" \
573 --backtitle \"\$DIALOG_BACKTITLE\" \
574 --hline \"\$hline\" \
575 --ok-label \"\$msg_proceed\" \
576 --cancel-label \"\$msg_cancel\" \
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\" \
577 --menu \"\$prompt\" $size \
585 --menu \"\$prompt\" \
586 $height $width $rows \
578 $menu_list \
579 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
580 )
581 local retval=$?
582 setvar DIALOG_MENU_$$ "$dialog_menu"
583
584 #
585 # XXX

--- 174 unchanged lines hidden ---
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 ---