summaryrefslogtreecommitdiff
path: root/source3/script/installdat.sh
diff options
context:
space:
mode:
Diffstat (limited to 'source3/script/installdat.sh')
-rwxr-xr-xsource3/script/installdat.sh62
1 files changed, 52 insertions, 10 deletions
diff --git a/source3/script/installdat.sh b/source3/script/installdat.sh
index 4a5b1de5dc..5d7958e273 100755
--- a/source3/script/installdat.sh
+++ b/source3/script/installdat.sh
@@ -1,23 +1,65 @@
#!/bin/sh
#fist version March 2002, Herb Lewis
-DATDIR=`echo $1 | sed 's/\/\//\//g'`
-SRCDIR=$2/
+DESTDIR=$1
+DATDIR=`echo $2 | sed 's/\/\//\//g'`
+SRCDIR=$3/
+shift
+shift
+shift
-echo Installing dat files in $DATDIR
+case $0 in
+ *uninstall*)
+ if test ! -d "$DESTDIR/$DATDIR"; then
+ echo "Directory $DESTDIR/$DATDIR does not exist! "
+ echo "Do a "make installmsg" or "make install" first. "
+ exit 1
+ fi
+ mode='uninstall'
+ ;;
+ *) mode='install' ;;
+esac
-for f in $SRCDIR/codepages/*.dat; do
- FNAME=$DATDIR/`basename $f`
- echo $FNAME
- cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
- chmod 0644 $FNAME
+for f in $@; do
+ FNAME="$DESTDIR/$DATDIR/$f.dat"
+ if test "$mode" = 'install'; then
+ echo "Installing $f.dat as $FNAME "
+ cp "$SRCDIR/codepages/$f.dat" "$FNAME"
+ if test ! -e "$FNAME"; then
+ echo "Cannot install $FNAME. Does $USER have privileges? "
+ exit 1
+ fi
+ chmod 0644 $FNAME
+ elif test "$mode" = 'uninstall'; then
+ echo "Removing $FNAME "
+ rm -f "$FNAME"
+ if test -e "$FNAME"; then
+ echo "Cannot remove $FNAME. Does $USER have privileges? "
+ exit 1
+ fi
+ else
+ echo "Unknown mode, $mode. Script called as $0 "
+ exit 1
+ fi
done
-cat << EOF
+if test "$mode" = 'install'; then
+ cat << EOF
======================================================================
-The dat files have been installed.
+The dat files have been installed. You may uninstall the dat files
+using the command "make uninstalldat" or "make uninstall" to uninstall
+binaries, man pages, dat files, and shell scripts.
======================================================================
EOF
+else
+ cat << EOF
+======================================================================
+The dat files have been removed. You may restore these files using
+the command "make installdat" or "make install" to install binaries,
+man pages, modules, dat files, and shell scripts.
+======================================================================
+EOF
+fi
exit 0