s4-install: fixed install path for python scripts
[kai/samba.git] / source4 / script / installmisc.sh
1 #!/bin/sh
2 # install miscellaneous files
3
4 [ $# -eq 5 ] || {
5     echo "Usage: installmisc.sh SRCDIR SETUPDIR BINDDIR SBINDDIR PYTHONDIR"
6     exit 1
7 }
8
9 SRCDIR="$1"
10 SETUPDIR="$2"
11 BINDIR="$3"
12 SBINDIR="$4"
13 PYTHONDIR="$5"
14
15 cd $SRCDIR || exit 1
16
17 # fixup a python script to use the right path
18 fix_python_path() {
19     f="$1"
20     egrep 'sys.path.insert.*bin/python' $f > /dev/null && {
21         sed -i "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" $f || exit 1
22     }
23 }
24
25 echo "Installing setup templates"
26 mkdir -p $SETUPDIR || exit 1
27 mkdir -p $SBINDIR || exit 1
28 mkdir -p $BINDIR || exit 1
29 mkdir -p $SETUPDIR/ad-schema || exit 1
30 mkdir -p $SETUPDIR/display-specifiers || exit1
31 cp setup/ad-schema/*.txt $SETUPDIR/ad-schema || exit 1
32 cp setup/display-specifiers/*.txt $SETUPDIR/display-specifiers || exit 1
33
34 echo "Installing sbin scripts from setup/*"
35 for p in domainlevel enableaccount newuser provision setexpiry setpassword pwsettings
36 do
37         cp setup/$p $SBINDIR || exit 1
38         chmod a+x $SBINDIR/$p
39         fix_python_path $SBINDIR/$p || exit 1
40 done
41
42 echo "Installing sbin scripts from scripting/bin/*"
43 for p in upgradeprovision
44 do
45         cp scripting/bin/$p $SBINDIR || exit 1
46         chmod a+x $SBINDIR/$p
47         fix_python_path $SBINDIR/$p || exit 1
48 done
49
50 echo "Installing remaining files in $SETUPDIR"
51 cp setup/schema-map-* $SETUPDIR || exit 1
52 cp setup/DB_CONFIG $SETUPDIR || exit 1
53 cp setup/*.inf $SETUPDIR || exit 1
54 cp setup/*.ldif $SETUPDIR || exit 1
55 cp setup/*.reg $SETUPDIR || exit 1
56 cp setup/*.zone $SETUPDIR || exit 1
57 cp setup/*.conf $SETUPDIR || exit 1
58 cp setup/*.php $SETUPDIR || exit 1
59 cp setup/*.txt $SETUPDIR || exit 1
60 cp setup/provision.smb.conf.dc $SETUPDIR || exit 1
61 cp setup/provision.smb.conf.member $SETUPDIR || exit 1
62 cp setup/provision.smb.conf.standalone $SETUPDIR || exit 1
63
64 exit 0