diff --git a/app-shells/command_not_found/command_not_found-0.0.1.recipe b/app-shells/command_not_found/command_not_found-0.0.1.recipe index 369fee274..89528990b 100644 --- a/app-shells/command_not_found/command_not_found-0.0.1.recipe +++ b/app-shells/command_not_found/command_not_found-0.0.1.recipe @@ -25,39 +25,14 @@ BUILD_REQUIRES=" cmd:python " POST_INSTALL_SCRIPTS=" - boot/post-install/options.sh + boot/post-install/install_cnf.py " INSTALL() { - #Unfortunately- we can't use install_cnf.py as it uses the old dir structure" - - mkdir -p $dataDir/profile.d - cat << EOF >> $dataDir/profile.d/command_not_found.sh -#!/bin/bash -if [ -e /boot/common/bin/python ]; then - command_not_found_handle() { - /bin/env python /bin/command_not_found "\$1" - } -else - command_not_found_handle() { - echo "\$1 not found: try installoptionalpkg \$1; and check installoptionalpkg -l" - } -fi -EOF - chmod 0777 $dataDir/profile.d/command_not_found.sh - - mkdir -p $postInstallDir - cat << EOF >> $postInstallDir/options.sh -mkdir -p ~/config/settings/command-not-found/ -cat << EOT >> ~/config/settings/command-not-found/options.json -{ -"autocorrect": false, -"spellcheck": false, -"haikuports": false -} -EOT -EOF - 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 } diff --git a/app-shells/command_not_found/install-script.patch b/app-shells/command_not_found/install-script.patch new file mode 100644 index 000000000..1e7d961de --- /dev/null +++ b/app-shells/command_not_found/install-script.patch @@ -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