On Thu, May 08, 2025 at 05:29:24PM -0700, Andrew Hewus Fresh wrote:
> It's pretty easy to fix fw_update.
> Apparently was not thinking when I wrote it.
> 
> Comments, OK?

In principle this is OK lucas, but I do have comments.

> Index: fw_update.sh
> ===================================================================
> RCS file: /cvs/src/usr.sbin/fw_update/fw_update.sh,v
> diff -u -p -r1.64 fw_update.sh
> --- fw_update.sh      22 Mar 2025 19:51:29 -0000      1.64
> +++ fw_update.sh      9 May 2025 00:27:38 -0000
> @@ -431,7 +431,7 @@ remove_files() {
>  }
>  
>  delete_firmware() {
> -     local _cwd _pkg="$1" _pkgdir="${DESTDIR}/var/db/pkg"
> +     local _cwd _pkg="$1" _pkgdir="${DESTDIR}/var/db/pkg" _remove _l
>  
>       # TODO: Check hash for files before deleting
>       ((VERBOSE > 2)) && echo -n "Uninstall $_pkg ..."
> @@ -445,13 +445,13 @@ delete_firmware() {
>  
>       sET -A _remove -- "${_cwd}/+CONTENTS" "${_cwd}"
>  
> -     while read -r _c _g; do
> -             case $_c in
> -             @cwd) _cwd="${DESTDIR}$_g"
> +     while read -r _l; do
> +             case ${_l%% *} in
> +             @cwd) _cwd="${DESTDIR}${_l#* }"
>                 ;;
>               @*) continue
>                 ;;
> -             *) set -A _remove -- "$_cwd/$_c" "${_remove[@]}"
> +             *) set -A _remove -- "$_cwd/$_l" "${_remove[@]}"

Doesn't only the following take care of it? And saves you from parsing
the line manually. In which case, you might also want to keep the chunk
that adds _remove, _c and _g to local.

+               *) set -A _remove -- "$_cwd/$_g" "${_remove[@]}"

>                 ;;
>               esac
>       done < "${_pkgdir}/${_pkg}/+CONTENTS"
> 

Reply via email to