On commit3010ab8("base-files: add update_alternatives function") was implemented the function to handle ALTERNATIVES when using APK (OPKG handle it internally) but in commitbcc6415("base-files: add compatibility for APK and OPKG") was only called when adding a package, so call it also when removing packages. While we are here, check for a more specific *.alternatives files instead of *.list, and remove redundant "filelist" variable definition. Fixes:bcc6415("base-files: add compatibility for APK and OPKG") Fixes: https://github.com/openwrt/openwrt/issues/19090 Fixes: https://github.com/openwrt/openwrt/issues/16991 Reported-and-tested-by: Eric Fahlgren <ericfahlgren@gmail.com> Signed-off-by: Mario Andrés Pérez <mapb_@outlook.com> Link: https://github.com/openwrt/openwrt/pull/19093 Signed-off-by: Robert Marko <robimarko@gmail.com>