Files
haikuports/app-shells/command_not_found/install-script.patch
2014-01-04 15:35:32 +00:00

49 lines
1.5 KiB
Diff

--- 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