1if [ ! "$_PACKAGES_INDEX_SUBR" ]; then _PACKAGES_INDEX_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 (INCLUDING, 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/index.subr 264840 2014-04-23 22:04:04Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." packages/index.subr 34f_include $BSDCFG_SHARE/device.subr 35f_include $BSDCFG_SHARE/media/common.subr --- 54 unchanged lines hidden (view full) --- 90 local __var_to_set="${2:-PACKAGE_INDEX}" 91 92 [ "$_INDEX_INITTED" ] && return $SUCCESS 93 94 # Got any media? 95 f_media_verify || return $FAILURE 96 97 # Does it move when you kick it? |
98 f_device_init device_media || return $FAILURE |
99 100 f_show_info "$msg_attempting_to_update_repository_catalogue" 101 102 # 103 # Generate $PACKAGESITE variable for pkg(8) based on media type 104 # 105 local __type __data __site 106 device_media get type __type --- 18 unchanged lines hidden (view full) --- 125 *) # UFS, DISK, CDROM, USB, DOS, NFS, etc. 126 __site="file://$MOUNTPOINT/packages/$PKG_ABI" 127 esac 128 129 export PACKAGESITE="$__site" 130 f_dprintf "PACKAGESITE=[%s]" "$PACKAGESITE" 131 if ! f_eval_catch $__funcname pkg "pkg update"; then 132 f_show_err "$msg_unable_to_update_pkg_from_selected_media" |
133 f_device_shutdown device_media |
134 return $FAILURE 135 fi 136 137 # 138 # Try to get contents from validated on-disk cache 139 # 140 141 # 142 # Calculate digest used to determine if the on-disk persistant cache 143 # INDEX (containing this digest on the first line) is valid and can be 144 # used to quickly populate the environment. 145 # 146 local __sqlite_digest 147 if ! __sqlite_digest=$( md5 < "$SQLITE_REPO" 2> /dev/null ); then 148 f_show_err "$msg_no_pkg_database_found" |
149 f_device_shutdown device_media |
150 return $FAILURE 151 fi 152 153 # 154 # Check to see if the persistant cache INDEX file exists 155 # 156 if [ -f "$PACKAGES_INDEX_CACHEFILE" ]; then 157 # --- 45 unchanged lines hidden (view full) --- 203 { 204 cats = categories[package] 205 sub(/^ /, "", cats) 206 gsub(/[^[:alnum:]_]/, "_", package) 207 printf "local _%s_categories=\"%s\";\n", package, cats 208 } 209 }' )"; then 210 f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" |
211 f_device_shutdown device_media |
212 return $FAILURE 213 fi 214 215 f_show_info "$msg_getting_package_dependencies_via_pkg_rquery" 216 if ! eval "$( pkg rquery "%n-%v %dn-%dv" | awk ' 217 { rundeps[$1] = rundeps[$1] " " $2 } 218 END { 219 for (package in rundeps) 220 { 221 deps = rundeps[package] 222 sub(/^ /, "", deps) 223 gsub(/[^[:alnum:]_]/, "_", package) 224 printf "local _%s_rundeps=\"%s\";\n", package, deps 225 } 226 }' )"; then 227 f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" |
228 f_device_shutdown device_media |
229 return $FAILURE 230 fi 231 232 f_show_info "$msg_generating_index_from_pkg_database" 233 eval "$__var_to_set"='$( pkg rquery "$INDEX_FORMAT" | 234 while read LINE; do 235 package="${LINE%%|*}"; 236 f_str2varname "$package" varpkg; --- 237 unchanged lines hidden --- |