summaryrefslogtreecommitdiffstats
path: root/source3/script/installmsg.sh
blob: 859e4c10cf9582b968b6fd2050aefd33e91bdd81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
# first version (Sept 2003) written by Shiro Yamada <shiro@miraclelinux.com>
# based on the first verion (March 2002) of installdat.sh written by Herb Lewis

DESTDIR=$1
MSGDIR=`echo $2 | sed 's/\/\//\//g'`
SRCDIR=$3/
shift
shift
shift

case $0 in
	*uninstall*)
		if test ! -d "$DESTDIR/$MSGDIR"; then
			echo "Directory $DESTDIR/$MSGDIR does not exist! "
			echo "Do a "make installmsg" or "make install" first. "
			exit 1
		fi
		mode='uninstall'
		;;
	*) mode='install' ;;
esac

for f in $SRCDIR/po/*.msg; do
	FNAME="$DESTDIR/$MSGDIR/`basename $f`"
	if test "$mode" = 'install'; then
		echo "Installing $f as $FNAME "
		cp "$f" "$FNAME"
		if test ! -f "$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 -f "$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

if test "$mode" = 'install'; then
	cat << EOF
==============================================================================
The SWAT msg files have been installed.  You may uninstall the msg files using
the command "make uninstallmsg" or "make uninstall" to uninstall binaries, man
pages, msg files, and shell scripts.
==============================================================================
EOF
else
	cat << EOF
=============================================================================
The SWAT msg files have been removed.  You may restore these files using the
command "make installmsg" or "make install" to install binaries, man pages,
modules, msg files, and shell scripts.
======================================================================
EOF
fi

exit 0