index.subr (279609) | index.subr (279610) |
---|---|
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# | 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: stable/10/usr.sbin/bsdconfig/share/packages/index.subr 279609 2015-03-05 00:29:58Z dteske $ | 27# $FreeBSD: stable/10/usr.sbin/bsdconfig/share/packages/index.subr 279610 2015-03-05 00:32:54Z 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 --- 200 unchanged lines hidden (view full) --- 236 237 # Export variables required by awk(1) below 238 export msg_no_description_provided 239 export msg_all msg_all_desc 240 export VALID_VARNAME_CHARS 241 export msg_packages 242 243 eval "$( debug= f_getvar "$var_to_get" | awk -F'|' ' | 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 --- 200 unchanged lines hidden (view full) --- 236 237 # Export variables required by awk(1) below 238 export msg_no_description_provided 239 export msg_all msg_all_desc 240 export VALID_VARNAME_CHARS 241 export msg_packages 242 243 eval "$( debug= f_getvar "$var_to_get" | awk -F'|' ' |
244 function asorti(src, dest) | 244 function _asorti(src, dest) |
245 { 246 k = nitems = 0 247 248 # Copy src indices to dest and calculate array length 249 for (i in src) dest[++nitems] = i 250 251 # Sort the array of indices (dest) using insertion sort method 252 for (i = 1; i <= nitems; k = i++) --- 34 unchanged lines hidden (view full) --- 287 split($7, pkg_categories, /[[:space:]]+/) 288 for (pkg_category in pkg_categories) 289 categories[pkg_categories[pkg_category]]++ 290 print "_rundeps_" varpkg "=\"" $9 "\"" 291 } 292 END { 293 print "_npkgs=" tpkgs # For convenience, total package count 294 | 245 { 246 k = nitems = 0 247 248 # Copy src indices to dest and calculate array length 249 for (i in src) dest[++nitems] = i 250 251 # Sort the array of indices (dest) using insertion sort method 252 for (i = 1; i <= nitems; k = i++) --- 34 unchanged lines hidden (view full) --- 287 split($7, pkg_categories, /[[:space:]]+/) 288 for (pkg_category in pkg_categories) 289 categories[pkg_categories[pkg_category]]++ 290 print "_rundeps_" varpkg "=\"" $9 "\"" 291 } 292 END { 293 print "_npkgs=" tpkgs # For convenience, total package count 294 |
295 n = asorti(categories, categories_sorted) | 295 n = _asorti(categories, categories_sorted) |
296 297 # Produce package counts for each category 298 for (i = 1; i <= n; i++) 299 { 300 cat = varcat = categories_sorted[i] 301 npkgs = categories[cat] 302 gsub("[^" valid_chars "]", "_", varcat) 303 print "_npkgs_" varcat "=\"" npkgs "\"" --- 111 unchanged lines hidden --- | 296 297 # Produce package counts for each category 298 for (i = 1; i <= n; i++) 299 { 300 cat = varcat = categories_sorted[i] 301 npkgs = categories[cat] 302 gsub("[^" valid_chars "]", "_", varcat) 303 print "_npkgs_" varcat "=\"" npkgs "\"" --- 111 unchanged lines hidden --- |