s4:tortore/rpc/spoolss.c: fix compiler warning
[Samba/nascimento.git] / source4 / script / installmisc.sh
blob5c7d76d5e41e5dfc00ab8aa858eb8f78fc8a306d
1 #!/bin/sh
2 # install miscellaneous files
4 [ $# -eq 8 ] || {
5 echo "Usage: installmisc.sh DESTDIR SRCDIR SETUPDIR PRIVATEDIR BINDDIR SBINDDIR PYTHONDIR PYTHON"
6 exit 1
9 DESTDIR="$1"
10 SRCDIR="$2"
11 SETUPDIR="$3"
12 PRIVATEDIR="$4"
13 BINDIR="$5"
14 SBINDIR="$6"
15 PYTHONDIR="$7"
16 PYTHON="$8"
18 cd $SRCDIR || exit 1
20 if $PYTHON -c "import sys; sys.exit('$PYTHONDIR' in sys.path)"; then
21 PYTHON_PATH_NEEDS_FIXING=yes
22 echo "sys.path in python scripts will be updated to include $PYTHONDIR"
23 else
24 PYTHON_PATH_NEEDS_FIXING=no
27 # fixup a python script to use the right path
28 fix_python_path() {
29 f="$1"
30 if egrep 'sys.path.insert.*bin/python' $f > /dev/null; then
31 if [ "$PYTHON_PATH_NEEDS_FIXING" = "yes" ]; then
32 # old systems don't have sed -i :-(
33 sed "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" < $f > $f.$$ || exit 1
34 else
35 # old systems don't have sed -i :-(
36 sed "s|\(sys.path.insert.*\)bin/python\(.*\)$||g" < $f > $f.$$ || exit 1
38 mv -f $f.$$ $f || exit 1
39 chmod +x $f
43 echo "Installing setup templates"
44 mkdir -p $SETUPDIR || exit 1
45 mkdir -p $SBINDIR || exit 1
46 mkdir -p $BINDIR || exit 1
47 mkdir -p $SETUPDIR/ad-schema || exit 1
48 mkdir -p $SETUPDIR/display-specifiers || exit1
49 cp setup/ad-schema/*.txt $SETUPDIR/ad-schema || exit 1
50 cp setup/display-specifiers/*.txt $SETUPDIR/display-specifiers || exit 1
52 echo "Installing sbin scripts from setup/*"
53 for p in provision
55 cp setup/$p $SBINDIR || exit 1
56 chmod a+x $SBINDIR/$p
57 fix_python_path $SBINDIR/$p || exit 1
58 done
60 echo "Installing sbin scripts from scripting/bin/*"
61 for p in upgradeprovision samba_dnsupdate
63 cp scripting/bin/$p $SBINDIR || exit 1
64 chmod a+x $SBINDIR/$p
65 fix_python_path $SBINDIR/$p || exit 1
66 done
68 echo "Installing remaining files in $SETUPDIR"
69 cp setup/schema-map-* $SETUPDIR || exit 1
70 cp setup/DB_CONFIG $SETUPDIR || exit 1
71 cp setup/*.inf $SETUPDIR || exit 1
72 cp setup/*.ldif $SETUPDIR || exit 1
73 cp setup/*.reg $SETUPDIR || exit 1
74 cp setup/*.zone $SETUPDIR || exit 1
75 cp setup/*.conf $SETUPDIR || exit 1
76 cp setup/*.php $SETUPDIR || exit 1
77 cp setup/*.txt $SETUPDIR || exit 1
78 cp setup/named.conf $SETUPDIR || exit 1
79 cp setup/named.conf.update $SETUPDIR || exit 1
80 cp setup/provision.smb.conf.dc $SETUPDIR || exit 1
81 cp setup/provision.smb.conf.member $SETUPDIR || exit 1
82 cp setup/provision.smb.conf.standalone $SETUPDIR || exit 1
84 echo "Installing external python libraries"
85 mkdir -p $PYTHONDIR/samba_external || exit 1
86 for p in $($PYTHON scripting/python/samba_external/missing.py);
88 echo "Installing missing python library $p"
89 mkdir -p $PYTHONDIR/samba_external/$p
90 cp -r scripting/python/samba_external/$p/* $PYTHONDIR/samba_external/$p/ || exit 1
91 done
93 echo "Installing stuff in $PRIVATEDIR"
94 cp setup/dns_update_list $PRIVATEDIR || exit 1
96 exit 0