summaryrefslogtreecommitdiff
path: root/source4/script
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-12-27 17:30:59 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-12-27 17:30:59 +0100
commit72d93599d95cd8bb57823fd0d4934ca4373d162c (patch)
treeb3f9ecc307ffbacce79ed70ac1f332aab25f4ab3 /source4/script
parentff0f8bd9e6abe53805be3019ecb6bf3ed384ea4b (diff)
downloadsamba-72d93599d95cd8bb57823fd0d4934ca4373d162c.tar.gz
samba-72d93599d95cd8bb57823fd0d4934ca4373d162c.tar.bz2
samba-72d93599d95cd8bb57823fd0d4934ca4373d162c.zip
python: Remove sys.path line rather than updating it when installing to python system path.
Diffstat (limited to 'source4/script')
-rwxr-xr-xsource4/script/installmisc.sh40
1 files changed, 27 insertions, 13 deletions
diff --git a/source4/script/installmisc.sh b/source4/script/installmisc.sh
index cb618628b0..c25b052dde 100755
--- a/source4/script/installmisc.sh
+++ b/source4/script/installmisc.sh
@@ -1,28 +1,42 @@
#!/bin/sh
# install miscellaneous files
-[ $# -eq 5 ] || {
- echo "Usage: installmisc.sh SRCDIR SETUPDIR BINDDIR SBINDDIR PYTHONDIR"
+[ $# -eq 7 ] || {
+ echo "Usage: installmisc.sh DESTDIR SRCDIR SETUPDIR BINDDIR SBINDDIR PYTHONDIR PYTHON"
exit 1
}
-SRCDIR="$1"
-SETUPDIR="$2"
-BINDIR="$3"
-SBINDIR="$4"
-PYTHONDIR="$5"
+DESTDIR="$1"
+SRCDIR="$2"
+SETUPDIR="$3"
+BINDIR="$4"
+SBINDIR="$5"
+PYTHONDIR="$6"
+PYTHON="$7"
cd $SRCDIR || exit 1
+if $PYTHON -c "import sys; sys.exit('$PYTHONDIR' in sys.path)"; then
+ PYTHON_PATH_NEEDS_FIXING=yes
+ echo "sys.path in python scripts will be updated to include $PYTHONDIR"
+else
+ PYTHON_PATH_NEEDS_FIXING=no
+fi
+
# fixup a python script to use the right path
fix_python_path() {
f="$1"
- egrep 'sys.path.insert.*bin/python' $f > /dev/null && {
- # old systems don't have sed -i :-(
- sed "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" < $f > $f.$$ || exit 1
- mv -f $f.$$ $f || exit 1
- chmod +x $f
- }
+ if egrep 'sys.path.insert.*bin/python' $f > /dev/null; then
+ if [ "$PYTHON_PATH_NEEDS_FIXING" = "yes" ]; then
+ # old systems don't have sed -i :-(
+ sed "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" < $f > $f.$$ || exit 1
+ else
+ # old systems don't have sed -i :-(
+ sed "s|\(sys.path.insert.*\)bin/python\(.*\)$||g" < $f > $f.$$ || exit 1
+ fi
+ mv -f $f.$$ $f || exit 1
+ chmod +x $f
+ fi
}
echo "Installing setup templates"