# HG changeset patch # User Franz Glasner # Date 1727866784 -7200 # Node ID 45051412d0b87bd359c44d8a636d5a974566695d # Parent 7cb17eaac812eea498c108b5ce135857e17cfc8f check-ports: modernized somewhat: quoting and "read -r" diff -r 7cb17eaac812 -r 45051412d0b8 sbin/check-ports --- a/sbin/check-ports Wed Oct 02 12:48:41 2024 +0200 +++ b/sbin/check-ports Wed Oct 02 12:59:44 2024 +0200 @@ -45,15 +45,16 @@ # # Configuration directory # -: ${CONFIGDIR:=@@ETCDIR@@} +: ${CONFIGDIR:="@@ETCDIR@@"} -test -r "${CONFIGDIR}/pkgtools.conf" && . "${CONFIGDIR}/pkgtools.conf" + +[ -r "${CONFIGDIR}/pkgtools.conf" ] && . "${CONFIGDIR}/pkgtools.conf" # # Mapping configuration: installed package name -> original package name # Note: This is independent of any repo # -: ${PACKAGE_MAPPING:=${CONFIGDIR}/package-mapping.conf} +: ${PACKAGE_MAPPING:="${CONFIGDIR}"/package-mapping.conf} # # Local repository with non-public packages and/or ports with changed @@ -168,7 +169,7 @@ # character. See re_format(7). # _lines=$(/usr/bin/grep -G '^'"${_package}" "${_indexdir}/${_indexfile}") - while read _line ; do + while read -r _line ; do _fqpn="${_line%%|*}" _n=${_fqpn%-*} if [ "${_package}" = "${_n}" ] ; then @@ -212,12 +213,12 @@ _package="$1" if [ -r "${PACKAGE_MAPPING}" ] ; then - while read _n _mapped ; do + while read -r _n _mapped ; do if [ "${_n}" = "${_package}" ] ; then printf '%s' "${_mapped}" return 0 fi - done < ${PACKAGE_MAPPING} + done < "${PACKAGE_MAPPING}" fi return 1 }