cnf: Only search for packages when shell is interactive

If we're inside a script, we can't ask a user to install a package, so
just return with an error. Example:

$ banshee
-bash: banshee: command not found
Install package 'banshee' to provide command 'banshee'? [N/y]
$ bash -c '. /etc/profile.d/PackageKit.sh; banshee'
bash: banshee: command not found

Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
Dan Nicholson 2014-04-05 13:22:04 +02:00 committed by Richard Hughes
parent b8f5de2e0c
commit a13d6535a6

View File

@ -10,6 +10,9 @@ command_not_found_handle () {
local runcnf=1
local retval=127
# only search for the command if we're interactive
[[ $- =~ i ]] || runcnf=0
# don't run if DBus isn't running
[ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0