1SUMMARY="A tool to find not-installed applications"
2DESCRIPTION="Command-not-found hooks into the command_not_found_handle \
3to inform end users where to find an application if they don't have it. \
4It can also check for typos (a feature of zsh)."
5HOMEPAGE="https://github.com/jrabbit/haiku-cnf"
6COPYRIGHT="2011 Jrabbit"
7LICENSE="GNU GPL v2"
8REVISION="5"
9srcGitRev="db1be8b57dedff781dc68caa46f403d88c5eedb9"
10SOURCE_URI="$HOMEPAGE/archive/$srcGitRev.tar.gz"
11CHECKSUM_SHA256="a1ce4e6c8a7307c0d5c1e65a90b3d2a7ba9d16d9506a70aab1005129333d6121"
12SOURCE_FILENAME="haiku-cnf-$portVersion-$srcGitRev.tar.gz"
13SOURCE_DIR="haiku-cnf-$srcGitRev"
14PATCHES="command_not_found-0.0.1~git.patchset"
15
16ARCHITECTURES="any"
17
18PROVIDES="
19	command_not_found = $portVersion
20	cmd:command_not_found = $portVersion
21	"
22REQUIRES="
23	haiku
24	cmd:python3
25	"
26
27BUILD_REQUIRES="
28	haiku_devel
29	"
30BUILD_PREREQUIRES="
31	cmd:install
32	"
33
34TEST_REQUIRES="
35	cmd:python3
36	"
37
38BUILD()
39{
40	true
41}
42
43INSTALL()
44{
45	install -d $binDir $dataDir/profile.d
46	install -m 0755 haiku_cnf.py $binDir/command_not_found
47
48	cat > $dataDir/profile.d/command-not-found.sh << EOF
49command_not_found_handle() {
50	if command -v command_not_found >/dev/null 2>&1; then
51		command_not_found "\$1"
52		return "\$?"
53	else
54		echo "\$1: command not found: try pkgman install cmd:\$1"
55		return 127 # bash return code for command not found
56	fi
57}
58EOF
59}
60
61TEST()
62{
63	python3 -m unittest test_cnf.py
64}
65