packages.subr (252745) | packages.subr (252771) |
---|---|
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 252745 2013-07-05 01:44:59Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/packages/packages.subr 252771 2013-07-05 06:20:01Z 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/device.subr --- 94 unchanged lines hidden (view full) --- 130 local package pkgsel 131 while [ $# -gt 0 ]; do 132 package="$1" 133 shift 1 # package 134 for pkgsel in $SELECTED_PACKAGES; do 135 [ "$package" = "$pkgsel" ] && return 136 done 137 SELECTED_PACKAGES="$SELECTED_PACKAGES $package" | 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/device.subr --- 94 unchanged lines hidden (view full) --- 130 local package pkgsel 131 while [ $# -gt 0 ]; do 132 package="$1" 133 shift 1 # package 134 for pkgsel in $SELECTED_PACKAGES; do 135 [ "$package" = "$pkgsel" ] && return 136 done 137 SELECTED_PACKAGES="$SELECTED_PACKAGES $package" |
138 f_dprintf "Added %s to selection list" "$package" |
|
138 done 139 SELECTED_PACKAGES="${SELECTED_PACKAGES# }" # Trim leading space 140} 141 142# f_package_deselect $package ... 143# 144# Remove $package from teh list of tracked/selected packages. If $package is 145# not being tracked (doesn't appear in $SELECTED_PACKAGES), this function --- 6 unchanged lines hidden (view full) --- 152 local new_list="" 153 package="$1" 154 shift 1 # package 155 for pkgsel in $SELECTED_PACKAGES; do 156 [ "$pkgsel" = "$package" ] && continue 157 new_list="$new_list${new_list:+ }$pkgsel" 158 done 159 SELECTED_PACKAGES="$new_list" | 139 done 140 SELECTED_PACKAGES="${SELECTED_PACKAGES# }" # Trim leading space 141} 142 143# f_package_deselect $package ... 144# 145# Remove $package from teh list of tracked/selected packages. If $package is 146# not being tracked (doesn't appear in $SELECTED_PACKAGES), this function --- 6 unchanged lines hidden (view full) --- 153 local new_list="" 154 package="$1" 155 shift 1 # package 156 for pkgsel in $SELECTED_PACKAGES; do 157 [ "$pkgsel" = "$package" ] && continue 158 new_list="$new_list${new_list:+ }$pkgsel" 159 done 160 SELECTED_PACKAGES="$new_list" |
161 f_dprintf "Removed %s from selection list" "$package" |
|
160 done 161} 162 163# f_package_detect_installed 164# 165# Detect installed packages. Currently this searches /var/db/pkg for directory 166# entries and marks each entry as an installed/selected package. 167# --- 411 unchanged lines hidden (view full) --- 579# or the user has pressed ESC, or if they have chosen Cancel. 580# 581f_package_review() 582{ 583 local prompt # Calculated below 584 local menu_list # Calculated below 585 local hline="$hline_alnum_arrows_punc_tab_enter" 586 | 162 done 163} 164 165# f_package_detect_installed 166# 167# Detect installed packages. Currently this searches /var/db/pkg for directory 168# entries and marks each entry as an installed/selected package. 169# --- 411 unchanged lines hidden (view full) --- 581# or the user has pressed ESC, or if they have chosen Cancel. 582# 583f_package_review() 584{ 585 local prompt # Calculated below 586 local menu_list # Calculated below 587 local hline="$hline_alnum_arrows_punc_tab_enter" 588 |
587 f_dprintf "f_package_review: SELECTED_PACKAGES=[%s]" \ 588 "$SELECTED_PACKAGES" | 589 local fname=f_package_review 590 f_dprintf "%s: SELECTED_PACKAGES=[%s]" $fname "$SELECTED_PACKAGES" |
589 590 prompt=$( printf "$msg_reviewing_selected_packages" "$_All_nselected" ) 591 592 local package varpkg mark 593 for package in $SELECTED_PACKAGES; do 594 mark= 595 f_str2varname "$package" varpkg 596 f_getvar _mark_$varpkg mark --- 33 unchanged lines hidden (view full) --- 630 # Process each of the selected packages: 631 # + First, process packages marked for Install. 632 # + Second, process packages marked for Re-install. 633 # + Finally, process packages marked for Uninstall. 634 # 635 for package in $SELECTED_PACKAGES; do 636 mark= 637 f_str2varname "$package" varpkg | 591 592 prompt=$( printf "$msg_reviewing_selected_packages" "$_All_nselected" ) 593 594 local package varpkg mark 595 for package in $SELECTED_PACKAGES; do 596 mark= 597 f_str2varname "$package" varpkg 598 f_getvar _mark_$varpkg mark --- 33 unchanged lines hidden (view full) --- 632 # Process each of the selected packages: 633 # + First, process packages marked for Install. 634 # + Second, process packages marked for Re-install. 635 # + Finally, process packages marked for Uninstall. 636 # 637 for package in $SELECTED_PACKAGES; do 638 mark= 639 f_str2varname "$package" varpkg |
638 f_getvar _mark_$varpkg mark | 640 debug= f_getvar _mark_$varpkg mark |
639 [ "$mark" = "I" ] || continue | 641 [ "$mark" = "I" ] || continue |
642 f_dprintf "%s: Installing %s package" $fname "$package" |
|
640 f_package_add "$package" || continue 641 f_package_deselect "$package" 642 done 643 for package in $SELECTED_PACKAGES; do 644 mark= 645 f_str2varname "$package" varpkg | 643 f_package_add "$package" || continue 644 f_package_deselect "$package" 645 done 646 for package in $SELECTED_PACKAGES; do 647 mark= 648 f_str2varname "$package" varpkg |
646 f_getvar _mark_$varpkg mark | 649 debug= f_getvar _mark_$varpkg mark |
647 [ "$mark" = "R" ] || continue | 650 [ "$mark" = "R" ] || continue |
651 f_dprintf "%s: Reinstalling %s package" $fname "$package" |
|
648 # XXX Re-install package 649 f_package_deselect "$package" 650 done 651 for package in $SELECTED_PACKAGES; do 652 mark= 653 f_str2varname "$package" varpkg | 652 # XXX Re-install package 653 f_package_deselect "$package" 654 done 655 for package in $SELECTED_PACKAGES; do 656 mark= 657 f_str2varname "$package" varpkg |
654 f_getvar _mark_$varpkg mark | 658 debug= f_getvar _mark_$varpkg mark |
655 [ "$mark" = "U" ] || continue | 659 [ "$mark" = "U" ] || continue |
660 f_dprintf "%s: Uninstalling %s package" $fname "$package" |
|
656 # XXX Uninstall package 657 f_package_deselect "$package" 658 done 659 660 return $SUCCESS 661} 662 663# f_package_config --- 282 unchanged lines hidden (view full) --- 946# Extract a package based on a namespec and media device. If $depended is 947# present and non-NULL, the notification displayed while installing the package 948# has "as a dependency" appended. 949# 950f_package_extract() 951{ 952 local device="$1" name="$2" depended="$3" 953 | 661 # XXX Uninstall package 662 f_package_deselect "$package" 663 done 664 665 return $SUCCESS 666} 667 668# f_package_config --- 282 unchanged lines hidden (view full) --- 951# Extract a package based on a namespec and media device. If $depended is 952# present and non-NULL, the notification displayed while installing the package 953# has "as a dependency" appended. 954# 955f_package_extract() 956{ 957 local device="$1" name="$2" depended="$3" 958 |
959 local fname=f_package_extract 960 f_dprintf "%s: device=[%s] name=[%s] depended=[%s]" \ 961 $fname "$device" "$name" "$depended" 962 |
|
954 # Check to make sure it's not already there 955 local varpkg mark= 956 f_str2varname "$name" varpkg 957 f_getvar _mark_$varpkg mark 958 [ "$mark" = "X" ] && return $SUCCESS 959 960 if ! f_device_init $device; then 961 f_show_msg \ --- 16 unchanged lines hidden (view full) --- 978 */*) path="$name" ;; 979 *) 980 case "$name" in 981 *-*|*_*) path="packages/All/$name" ;; 982 *) path="packages/Latest/$name" 983 esac 984 esac 985 | 963 # Check to make sure it's not already there 964 local varpkg mark= 965 f_str2varname "$name" varpkg 966 f_getvar _mark_$varpkg mark 967 [ "$mark" = "X" ] && return $SUCCESS 968 969 if ! f_device_init $device; then 970 f_show_msg \ --- 16 unchanged lines hidden (view full) --- 987 */*) path="$name" ;; 988 *) 989 case "$name" in 990 *-*|*_*) path="packages/All/$name" ;; 991 *) path="packages/Latest/$name" 992 esac 993 esac 994 |
986 local fname=f_package_extract 987 | |
988 # We have a path, call the device strategy routine to get the file 989 local pkg_ext probe_only=1 found= 990 for pkg_ext in "" $PACKAGE_EXTENSIONS; do 991 if f_device_get $device "$path$pkg_ext" $probe_only; then 992 path="$path$pkg_ext" 993 f_dprintf "%s: found path=[%s] dev=[%s]" \ 994 $fname "$path" "$device" 995 found=1 --- 62 unchanged lines hidden --- | 995 # We have a path, call the device strategy routine to get the file 996 local pkg_ext probe_only=1 found= 997 for pkg_ext in "" $PACKAGE_EXTENSIONS; do 998 if f_device_get $device "$path$pkg_ext" $probe_only; then 999 path="$path$pkg_ext" 1000 f_dprintf "%s: found path=[%s] dev=[%s]" \ 1001 $fname "$path" "$device" 1002 found=1 --- 62 unchanged lines hidden --- |