mirror of
https://github.com/sbopkg/sbopkg
synced 2025-01-29 20:34:34 +01:00
Modify do_install() in stable and trunk to correctly invoke upgradepkg to avoid
a fairly rare but serious case of removing the wrong package; thanks to NaCl for the bug report.
This commit is contained in:
parent
eb1cea4375
commit
8b87240383
2 changed files with 13 additions and 8 deletions
|
@ -106,3 +106,6 @@ enhancements:
|
|||
and instead make all queue formats "$APP" only. This simplifies some code
|
||||
and results in a small speed increase.
|
||||
* Exit edit_build_queue menu with 'ESC'; thanks to Nille for the bug report.
|
||||
* Modify do_install() to correctly invoke upgradepkg to avoid a fairly rare
|
||||
but serious case of removing the wrong package; thanks to NaCl for the
|
||||
bug report.
|
||||
|
|
|
@ -2701,16 +2701,18 @@ do_install() {
|
|||
# This is mostly equivalent to "upgradepkg --reinstall --install-new $@",
|
||||
# but also checks for renames
|
||||
|
||||
local PKG PKGNAME
|
||||
local OLDPKG
|
||||
local PKG OLDPKG
|
||||
local PKG_NAME PKG_VER PKG_ARCH PKG_BUILD PKG_TAG
|
||||
|
||||
for PKG in "$@"; do
|
||||
# Strip the path from $PKG
|
||||
PKGNAME=${PKG##*/}
|
||||
# Remove version, arch, build and tag
|
||||
PKGNAME=$(sed 's/-[^-]*-[^-]*-[^-]*$//' <<< "$PKGNAME")
|
||||
|
||||
get_old_name OLDPKG "$PKGNAME"
|
||||
split_pkg_name $PKG
|
||||
get_old_name OLDNAME "$PKG_NAME"
|
||||
# we grep ls's output rather than have ls return a glob so 'foo'
|
||||
# doesn't match 'foo-bar'
|
||||
if ! OLDPKG=$(ls /var/log/packages/ |
|
||||
grep -m1 "$OLDNAME-[^-]*-[^-]*-[^-]*$REPO_TAG$"); then
|
||||
OLDPKG=$PKG
|
||||
fi
|
||||
upgradepkg --reinstall --install-new $OLDPKG%"$PKG"
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue