9b8e88d5acf8b06d5a600c2aaeea76925ca3f29f

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #3483 from ai/fedora-not-found

Add Fedora support for command-not-found plugin

Diff

 1diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
 2index f3d7ec2df4128cdafc58bf134e30891f46002dc4..797554a13e3501787763a03d79e019d93f0261d9 100644
 3--- a/plugins/command-not-found/command-not-found.plugin.zsh
 4+++ b/plugins/command-not-found/command-not-found.plugin.zsh
 5@@ -7,3 +7,19 @@
 6 # Arch Linux command-not-found support, you must have package pkgfile installed
 7 # https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook
 8 [[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
 9+
10+# Fedora command-not-found support
11+if [ -f /usr/libexec/pk-command-not-found ]; then
12+    command_not_found_handler () {
13+        runcnf=1
14+        retval=127
15+        [ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0
16+        [ ! -x /usr/libexec/packagekitd ] && runcnf=0
17+        if [ $runcnf -eq 1 ]
18+            then
19+            /usr/libexec/pk-command-not-found $@
20+            retval=$?
21+        fi
22+        return $retval
23+    }
24+fi