Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/check-ports @ 706:45051412d0b8
check-ports: modernized somewhat: quoting and "read -r"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 02 Oct 2024 12:59:44 +0200 |
| parents | 7cb17eaac812 |
| children | f19ae639e7ff |
comparison
equal
deleted
inserted
replaced
| 705:7cb17eaac812 | 706:45051412d0b8 |
|---|---|
| 43 ' | 43 ' |
| 44 | 44 |
| 45 # | 45 # |
| 46 # Configuration directory | 46 # Configuration directory |
| 47 # | 47 # |
| 48 : ${CONFIGDIR:=@@ETCDIR@@} | 48 : ${CONFIGDIR:="@@ETCDIR@@"} |
| 49 | 49 |
| 50 test -r "${CONFIGDIR}/pkgtools.conf" && . "${CONFIGDIR}/pkgtools.conf" | 50 |
| 51 [ -r "${CONFIGDIR}/pkgtools.conf" ] && . "${CONFIGDIR}/pkgtools.conf" | |
| 51 | 52 |
| 52 # | 53 # |
| 53 # Mapping configuration: installed package name -> original package name | 54 # Mapping configuration: installed package name -> original package name |
| 54 # Note: This is independent of any repo | 55 # Note: This is independent of any repo |
| 55 # | 56 # |
| 56 : ${PACKAGE_MAPPING:=${CONFIGDIR}/package-mapping.conf} | 57 : ${PACKAGE_MAPPING:="${CONFIGDIR}"/package-mapping.conf} |
| 57 | 58 |
| 58 # | 59 # |
| 59 # Local repository with non-public packages and/or ports with changed | 60 # Local repository with non-public packages and/or ports with changed |
| 60 # OPTIONS (i.e. not using the defaults) or forks of official packages with | 61 # OPTIONS (i.e. not using the defaults) or forks of official packages with |
| 61 # other package names. | 62 # other package names. |
| 166 # character (e.g. for the "lucene++" package). | 167 # character (e.g. for the "lucene++" package). |
| 167 # Note that `^' at the start of an RE is not an ordinary | 168 # Note that `^' at the start of an RE is not an ordinary |
| 168 # character. See re_format(7). | 169 # character. See re_format(7). |
| 169 # | 170 # |
| 170 _lines=$(/usr/bin/grep -G '^'"${_package}" "${_indexdir}/${_indexfile}") | 171 _lines=$(/usr/bin/grep -G '^'"${_package}" "${_indexdir}/${_indexfile}") |
| 171 while read _line ; do | 172 while read -r _line ; do |
| 172 _fqpn="${_line%%|*}" | 173 _fqpn="${_line%%|*}" |
| 173 _n=${_fqpn%-*} | 174 _n=${_fqpn%-*} |
| 174 if [ "${_package}" = "${_n}" ] ; then | 175 if [ "${_package}" = "${_n}" ] ; then |
| 175 printf '%s' "${_fqpn##*-}" | 176 printf '%s' "${_fqpn##*-}" |
| 176 return 0 | 177 return 0 |
| 210 local _package _n _mapped | 211 local _package _n _mapped |
| 211 | 212 |
| 212 _package="$1" | 213 _package="$1" |
| 213 | 214 |
| 214 if [ -r "${PACKAGE_MAPPING}" ] ; then | 215 if [ -r "${PACKAGE_MAPPING}" ] ; then |
| 215 while read _n _mapped ; do | 216 while read -r _n _mapped ; do |
| 216 if [ "${_n}" = "${_package}" ] ; then | 217 if [ "${_n}" = "${_package}" ] ; then |
| 217 printf '%s' "${_mapped}" | 218 printf '%s' "${_mapped}" |
| 218 return 0 | 219 return 0 |
| 219 fi | 220 fi |
| 220 done < ${PACKAGE_MAPPING} | 221 done < "${PACKAGE_MAPPING}" |
| 221 fi | 222 fi |
| 222 return 1 | 223 return 1 |
| 223 } | 224 } |
| 224 | 225 |
| 225 | 226 |
