# HG changeset patch # User Franz Glasner # Date 1728310524 -7200 # Node ID b308d8e4c8adf1d4380c251e0f524c71352f549c # Parent 5379b253e8f2e3c68217fe21d21a8e8b0793d7ec check-ports: explicitely allow comments and empty lines in package-mapping.conf diff -r 5379b253e8f2 -r b308d8e4c8ad sbin/check-ports --- a/sbin/check-ports Mon Oct 07 15:51:06 2024 +0200 +++ b/sbin/check-ports Mon Oct 07 16:15:24 2024 +0200 @@ -210,14 +210,27 @@ ' local _package _n _mapped + local - + set -x + _package="$1" if [ -r "${PACKAGE_MAPPING}" ] ; then - while read -r _n _mapped ; do - if [ "${_n}" = "${_package}" ] ; then - printf '%s' "${_mapped}" - return 0 - fi + while IFS=$' \t' read -r _n _mapped ; do + case "${_n}" in + '') + # empty line + continue;; + \#*) + # comment + continue;; + *) + if [ "${_n}" = "${_package}" ] ; then + printf '%s' "${_mapped}" + return 0 + fi + ;; + esac done < "${PACKAGE_MAPPING}" fi return 1