Convert recipe into a patch

This commit is contained in:
dradancer
2014-01-04 15:35:32 +00:00
parent e318fea513
commit 5a61c9efed
2 changed files with 53 additions and 30 deletions

View File

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

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