aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-02 00:28:32 +0000
committermerakor <cem@ckyln.com>2020-05-02 00:28:32 +0000
commit82b1594543b7cb140542508e0f0a3e138c8b15a6 (patch)
treeb2a22c4b61d8fe27473523955db5fd42f01a3523
parentf97e617f90d6f9c282cb9e556136a6e4001d96c2 (diff)
downloadcpt-82b1594543b7cb140542508e0f0a3e138c8b15a6.tar.gz
kiss: fix pkg_conflicts for rare cases
This fixes pkg_conflicts where there are no packages or only one packages in the system FossilOrigin-Name: b94f9ace5332320d00b255b7b34093885c3c6d4f06da7ea6dc7d56b24c3a2b71
-rwxr-xr-xkiss11
1 files changed, 11 insertions, 0 deletions
diff --git a/kiss b/kiss
index 34e6a1e..e59a202 100755
--- a/kiss
+++ b/kiss
@@ -743,6 +743,17 @@ pkg_conflicts() {
[ -s "$cac_dir/$pid-m" ] || return 0
+ # In rare cases where the system only has one package installed
+ # and you are reinstalling that package, grep will try to read from
+ # standard input if we continue here.
+ #
+ # Also, if we don't have any packages installed grep will give an
+ # error. This will not cause the installation to fail, but we don't
+ # need to check for conflicts if that's the case anyway. If we have
+ # only zero packages or one package, just stop wasting time and continue
+ # with the installation.
+ [ "$1" ] && [ -f "$1" ] || return 0
+
# Enable alternatives automatically if it is safe to do so.
# This checks to see that the package that is about to be installed
# doesn't overwrite anything it shouldn't in '/var/db/kiss/installed'.