From 5ecfdb4c2f21b29a067824c2524c959bac61f9f8 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 26 Nov 2009 23:33:45 +0100 Subject: [PATCH] xbps-src: refuse to install a pkg already installed. --HG-- extra : convert_revision : dae07c3aa547ac13bc955dea44049f31242c02ed --- xbps-src/shutils/pkgtarget_funcs.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xbps-src/shutils/pkgtarget_funcs.sh b/xbps-src/shutils/pkgtarget_funcs.sh index 95f513d4dad..900136af553 100644 --- a/xbps-src/shutils/pkgtarget_funcs.sh +++ b/xbps-src/shutils/pkgtarget_funcs.sh @@ -30,7 +30,7 @@ # install_pkg() { - local curpkgn="$1" pkg cdestdir + local curpkgn="$1" fullpkg pkg cdestdir # # If we are being invoked through the chroot, re-read config file @@ -48,6 +48,20 @@ install_pkg() setup_tmpl $curpkgn fi + # + # Refuse to install the same package that is already installed. + # + . $XBPS_SHUTILSDIR/builddep_funcs.sh + check_installed_pkg "$pkg" + if [ $? -eq 1 -o $? -eq 0 ]; then + fullpkg="$pkgname-$($XBPS_PKGDB_CMD version $pkgname)" + msg_warn "$fullpkg is already installed, remove or reinstall it." + exit 0 + fi + + # + # Execute command in chroot if necessary. + # if [ -z "$base_chroot" -a -z "$in_chroot" ]; then . $XBPS_SHUTILSDIR/chroot.sh [ -n "$install_destdir_target" ] && cdestdir=yes