s3-waf: create a smbldap.so library.
[Samba/id10ts.git] / source3 / script / installdat.sh
blob2cc3677fba32c9dd584a6270205b2d94b5e681f3
1 #!/bin/sh
2 #fist version March 2002, Herb Lewis
4 DESTDIR=$1
5 DATDIR=`echo $2 | sed 's/\/\//\//g'`
6 SRCDIR=$3/
7 shift
8 shift
9 shift
11 case $0 in
12 *uninstall*)
13 if test ! -d "$DESTDIR/$DATDIR"; then
14 echo "Directory $DESTDIR/$DATDIR does not exist! "
15 echo "Do a "make installmsg" or "make install" first. "
16 exit 1
18 mode='uninstall'
20 *) mode='install' ;;
21 esac
23 for f in $SRCDIR/../codepages/*.dat; do
24 FNAME="$DESTDIR/$DATDIR/`basename $f`"
25 if test "$mode" = 'install'; then
26 echo "Installing $f as $FNAME "
27 cp "$f" "$FNAME"
28 if test ! -f "$FNAME"; then
29 echo "Cannot install $FNAME. Does $USER have privileges? "
30 exit 1
32 chmod 0644 "$FNAME"
33 elif test "$mode" = 'uninstall'; then
34 echo "Removing $FNAME "
35 rm -f "$FNAME"
36 if test -f "$FNAME"; then
37 echo "Cannot remove $FNAME. Does $USER have privileges? "
38 exit 1
40 else
41 echo "Unknown mode, $mode. Script called as $0 "
42 exit 1
44 done
46 if test "$mode" = 'install'; then
47 cat << EOF
48 ======================================================================
49 The dat files have been installed. You may uninstall the dat files
50 using the command "make uninstalldat" or "make uninstall" to uninstall
51 binaries, man pages, dat files, and shell scripts.
52 ======================================================================
53 EOF
54 else
55 cat << EOF
56 ======================================================================
57 The dat files have been removed. You may restore these files using
58 the command "make installdat" or "make install" to install binaries,
59 man pages, modules, dat files, and shell scripts.
60 ======================================================================
61 EOF
64 exit 0