heimdal-build: Add HEIMDAL_BINARY convenience method.
[Samba.git] / source4 / script / installmisc.sh
blob1de17811c7657e2861194c75050c74f132e58ee8
1 #!/bin/sh
2 # install miscellaneous files
4 [ $# -eq 7 ] || {
5 echo "Usage: installmisc.sh DESTDIR SRCDIR SETUPDIR BINDDIR SBINDDIR PYTHONDIR PYTHON"
6 exit 1
9 DESTDIR="$1"
10 SRCDIR="$2"
11 SETUPDIR="$3"
12 BINDIR="$4"
13 SBINDIR="$5"
14 PYTHONDIR="$6"
15 PYTHON="$7"
17 cd $SRCDIR || exit 1
19 if $PYTHON -c "import sys; sys.exit('$PYTHONDIR' in sys.path)"; then
20 PYTHON_PATH_NEEDS_FIXING=yes
21 echo "sys.path in python scripts will be updated to include $PYTHONDIR"
22 else
23 PYTHON_PATH_NEEDS_FIXING=no
26 # fixup a python script to use the right path
27 fix_python_path() {
28 f="$1"
29 if egrep 'sys.path.insert.*bin/python' $f > /dev/null; then
30 if [ "$PYTHON_PATH_NEEDS_FIXING" = "yes" ]; then
31 # old systems don't have sed -i :-(
32 sed "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" < $f > $f.$$ || exit 1
33 else
34 # old systems don't have sed -i :-(
35 sed "s|\(sys.path.insert.*\)bin/python\(.*\)$||g" < $f > $f.$$ || exit 1
37 mv -f $f.$$ $f || exit 1
38 chmod +x $f
42 echo "Installing setup templates"
43 mkdir -p $SETUPDIR || exit 1
44 mkdir -p $SBINDIR || exit 1
45 mkdir -p $BINDIR || exit 1
46 mkdir -p $SETUPDIR/ad-schema || exit 1
47 mkdir -p $SETUPDIR/display-specifiers || exit1
48 cp setup/ad-schema/*.txt $SETUPDIR/ad-schema || exit 1
49 cp setup/display-specifiers/*.txt $SETUPDIR/display-specifiers || exit 1
51 echo "Installing sbin scripts from setup/*"
52 for p in provision
54 cp setup/$p $SBINDIR || exit 1
55 chmod a+x $SBINDIR/$p
56 fix_python_path $SBINDIR/$p || exit 1
57 done
59 echo "Installing sbin scripts from scripting/bin/*"
60 for p in upgradeprovision samba_dnsupdate samba_spnupdate
62 cp scripting/bin/$p $SBINDIR || exit 1
63 chmod a+x $SBINDIR/$p
64 fix_python_path $SBINDIR/$p || exit 1
65 done
67 echo "Installing remaining files in $SETUPDIR"
68 cp setup/schema-map-* $SETUPDIR || exit 1
69 cp setup/DB_CONFIG $SETUPDIR || exit 1
70 cp setup/*.inf $SETUPDIR || exit 1
71 cp setup/*.ldif $SETUPDIR || exit 1
72 cp setup/*.reg $SETUPDIR || exit 1
73 cp setup/*.zone $SETUPDIR || exit 1
74 cp setup/*.conf $SETUPDIR || exit 1
75 cp setup/*.php $SETUPDIR || exit 1
76 cp setup/*.txt $SETUPDIR || exit 1
77 cp setup/named.conf $SETUPDIR || exit 1
78 cp setup/named.conf.update $SETUPDIR || exit 1
79 cp setup/provision.smb.conf.dc $SETUPDIR || exit 1
80 cp setup/provision.smb.conf.member $SETUPDIR || exit 1
81 cp setup/provision.smb.conf.standalone $SETUPDIR || exit 1
82 cp setup/dns_update_list $SETUPDIR || exit 1
83 cp setup/spn_update_list $SETUPDIR || exit 1
85 echo "Installing external python libraries"
86 mkdir -p $DESTDIR$PYTHONDIR || exit 1
87 MISSING="$($PYTHON scripting/python/samba_external/missing.py)"
88 for p in $MISSING
90 package=`basename $p`
91 echo "Installing missing python package $package"
92 mkdir -p $DESTDIR$PYTHONDIR/samba/external/$package
93 touch $DESTDIR$PYTHONDIR/samba/external/__init__.py
94 cp -r ../lib/$p/* $DESTDIR$PYTHONDIR/samba/external/$package/ || exit 1
95 done
98 exit 0