Merged in dradancer/haikuports (pull request #112)

Added recipe for command_not_found
This commit is contained in:
Scott McCreary
2014-01-04 16:04:18 -08:00
2 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
SUMMARY="Command-not-found program"
DESCRIPTION="Command-not-found hooks into the command_not_found_handle \
to inform end users where to find an application if they don't have it. \
It can also check for typos (a feature of zsh).
"
HOMEPAGE="https://github.com/jrabbit-cnf/"
SRC_URI="git+https://github.com/jrabbit/haiku-cnf.git#87cd5d0c212e377cffa5d3e2a00c143fe751c6fb"
ARCHITECTURES="x86 x86_gcc2"
REVISION="1"
DISABLE_SOURCE_PACKAGE="yes"
LICENSE="GNU GPL v2"
COPYRIGHT="(c) 2011 Jrabbit"
PROVIDES="
command_not_found = $portVersion
cmd:command_not_found = $portVersion
"
REQUIRES="
haiku >= $haikuVersion
cmd:python
"
BUILD_REQUIRES="
cmd:python
"
POST_INSTALL_SCRIPTS="
boot/post-install/install_cnf.py
"
INSTALL()
{
mkdir -p $binDir
install -m 0755 haiku_cnf.py $binDir/command_not_found
mkdir -p $postInstallDir
patch < "$portDir/install-script.patch"
mv install_cnf.py $postInstallDir
}

View File

@@ -0,0 +1,48 @@
--- install_cnf.py.orig 2014-01-04 15:27:36.568590336 +0000
+++ install_cnf.py 2014-01-04 15:30:33.947126272 +0000
@@ -1,32 +1,29 @@
#!/bin/env python
import os
-hacks = """# command-not-found tomfoolery
-if [ -e /boot/common/bin/python ]; then
- command_not_found_handle(){
- /boot/common/bin/python /boot/common/bin/command_not_found.py "$1"
- }
-else
- command_not_found_handle(){
- echo "$1 not found: try installoptionalpkg $1; and check installoptionalpkg -l"
- }
-fi
+hacks = """
+#!/bin/env python
+command_not_found_handle(){
+ /bin/env python /bin/command_not_found "$1"
+}
\n
"""
-
default_options="""{
"autocorrect": false,
"spellcheck": false,
"haikuports": false
}\n"""
-home = os.environ['HOME']
-if not os.path.exists("%s/config/settings/command-not-found/options.json" % home):
- profile = open("/etc/profile", "a")
+
+if not os.path.exists("/boot/common/etc/profile.d/command-not-found.sh")
+ os.mkdir("/boot/common/etc/profile.d")
+ profile = open("/boot/common/etc/profile.d/command-not-found.sh", "a")
profile.write(hacks)
profile.close()
+
+home = os.environ['HOME']
+if not os.path.exists("%s/config/settings/command-not-found/options.json" % home):
os.mkdir("%s/config/settings/command-not-found/" % home)
options = open("%s/config/settings/command-not-found/options.json" % home, "w")
options.write(default_options)
options.close()
-os.system("install -m 755 haiku_cnf.py /boot/common/bin/command_not_found.py")
\ No newline at end of file