Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
192 - 1
# Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
2
#
3
# Licensed under the GNU General Public License Version 2
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
 
9
command_not_found_handle () {
10
	local runcnf=1
11
	local retval=127
12
 
13
	# only search for the command if we're interactive
14
	[[ $- == *"i"* ]] || runcnf=0
15
 
16
	# don't run if DBus isn't running
17
	[[ ! -S /run/dbus/system_bus_socket ]] && runcnf=0
18
 
19
	# don't run if packagekitd doesn't exist in the _system_ root
20
	[[ ! -x '/usr/libexec/packagekitd' ]] && runcnf=0
21
 
22
	# don't run if bash command completion is being run
23
	[[ -n ${COMP_CWORD-} ]] && runcnf=0
24
 
25
	# don't run if we've been uninstalled since the shell was launched
26
	[[ ! -x '/usr/libexec/pk-command-not-found' ]] && runcnf=0
27
 
28
	# run the command, or just print a warning
29
	if [ $runcnf -eq 1 ]; then
30
		'/usr/libexec/pk-command-not-found' "$@"
31
		retval=$?
32
	elif [[ -n "${BASH_VERSION-}" ]]; then
33
		printf >&2 'bash: %scommand not found\n' "${1:+$1: }"
34
	fi
35
 
36
	# return success or failure
37
	return $retval
38
}
39
 
40
if [[ -n "${ZSH_VERSION-}" ]]; then
41
	command_not_found_handler () {
42
		command_not_found_handle "$@" && return 127
43
	}
44
fi