s4-install: fixed install path for python scripts
authorAndrew Tridgell <tridge@samba.org>
Thu, 26 Nov 2009 02:06:01 +0000 (13:06 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 27 Nov 2009 05:05:05 +0000 (16:05 +1100)
when we install python scripts we need to fix the internal path used
to find modules. We also need to install the scripts in the right
place. Most of them should go in $SBINDIR not share/setup/

source4/Makefile
source4/script/installmisc.sh

index 03b4e7364aa3b3fc3a06a9be58802de306dfec40..8f23da5679cb691b8b3978efca4f43655fcc1353 100644 (file)
@@ -114,14 +114,6 @@ libgpodir := libgpo
 
 include data.mk
 
-INSTALL_SCRIPTS = $(addprefix scripting/bin/, \
-       autoidl \
-       samba3dump \
-       rpcclient \
-       smbstatus)
-
-$(foreach SCRIPT,$(INSTALL_SCRIPTS),$(eval $(call binary_install_template,$(SCRIPT))))
-
 $(DESTDIR)$(bindir)/%: scripting/bin/% installdirs
        @mkdir -p $(@D)
        @echo Installing $(@F) as $@
@@ -253,7 +245,7 @@ installman:: manpages installdirs
        @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
 
 installmisc:: installdirs
-       @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(setupdir)
+       @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(setupdir) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(pythondir)
 
 installpc:: installdirs
        @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(pkgconfigdir) $(PC_FILES)
index d0376b3f5d73e61b5d1180b1576b0aa9f6823513..7851d1f77da4ff9641bec22425dff1ee3e197910 100755 (executable)
@@ -1,22 +1,53 @@
 #!/bin/sh
 # install miscellaneous files
 
+[ $# -eq 5 ] || {
+    echo "Usage: installmisc.sh SRCDIR SETUPDIR BINDDIR SBINDDIR PYTHONDIR"
+    exit 1
+}
+
 SRCDIR="$1"
 SETUPDIR="$2"
+BINDIR="$3"
+SBINDIR="$4"
+PYTHONDIR="$5"
 
 cd $SRCDIR || exit 1
 
+# fixup a python script to use the right path
+fix_python_path() {
+    f="$1"
+    egrep 'sys.path.insert.*bin/python' $f > /dev/null && {
+       sed -i "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" $f || exit 1
+    }
+}
+
 echo "Installing setup templates"
 mkdir -p $SETUPDIR || exit 1
+mkdir -p $SBINDIR || exit 1
+mkdir -p $BINDIR || exit 1
 mkdir -p $SETUPDIR/ad-schema || exit 1
 mkdir -p $SETUPDIR/display-specifiers || exit1
 cp setup/ad-schema/*.txt $SETUPDIR/ad-schema || exit 1
 cp setup/display-specifiers/*.txt $SETUPDIR/display-specifiers || exit 1
+
+echo "Installing sbin scripts from setup/*"
 for p in domainlevel enableaccount newuser provision setexpiry setpassword pwsettings
 do
-       chmod a+x setup/$p
-       cp setup/$p $SETUPDIR || exit 1
+       cp setup/$p $SBINDIR || exit 1
+       chmod a+x $SBINDIR/$p
+       fix_python_path $SBINDIR/$p || exit 1
 done
+
+echo "Installing sbin scripts from scripting/bin/*"
+for p in upgradeprovision
+do
+       cp scripting/bin/$p $SBINDIR || exit 1
+       chmod a+x $SBINDIR/$p
+       fix_python_path $SBINDIR/$p || exit 1
+done
+
+echo "Installing remaining files in $SETUPDIR"
 cp setup/schema-map-* $SETUPDIR || exit 1
 cp setup/DB_CONFIG $SETUPDIR || exit 1
 cp setup/*.inf $SETUPDIR || exit 1