comparison sbin/check-ports @ 736:b308d8e4c8ad

check-ports: explicitely allow comments and empty lines in package-mapping.conf
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 07 Oct 2024 16:15:24 +0200
parents f19ae639e7ff
children 907cbedee676
comparison
equal deleted inserted replaced
735:5379b253e8f2 736:b308d8e4c8ad
208 fmg-nextcloud-twofactor_totp-php71 nextcloud-twofactor_totp-php71 208 fmg-nextcloud-twofactor_totp-php71 nextcloud-twofactor_totp-php71
209 209
210 ' 210 '
211 local _package _n _mapped 211 local _package _n _mapped
212 212
213 local -
214 set -x
215
213 _package="$1" 216 _package="$1"
214 217
215 if [ -r "${PACKAGE_MAPPING}" ] ; then 218 if [ -r "${PACKAGE_MAPPING}" ] ; then
216 while read -r _n _mapped ; do 219 while IFS=$' \t' read -r _n _mapped ; do
217 if [ "${_n}" = "${_package}" ] ; then 220 case "${_n}" in
218 printf '%s' "${_mapped}" 221 '')
219 return 0 222 # empty line
220 fi 223 continue;;
224 \#*)
225 # comment
226 continue;;
227 *)
228 if [ "${_n}" = "${_package}" ] ; then
229 printf '%s' "${_mapped}"
230 return 0
231 fi
232 ;;
233 esac
221 done < "${PACKAGE_MAPPING}" 234 done < "${PACKAGE_MAPPING}"
222 fi 235 fi
223 return 1 236 return 1
224 } 237 }
225 238