[206] | 1 | #!/bin/sh
|
---|
| 2 | # first version (Sept 2003) written by Shiro Yamada <shiro@miraclelinux.com>
|
---|
| 3 | # based on the first verion (March 2002) of installdat.sh written by Herb Lewis
|
---|
| 4 |
|
---|
| 5 | DESTDIR=$1
|
---|
| 6 | MSGDIR=`echo $2 | sed 's/\/\//\//g'`
|
---|
| 7 | SRCDIR=$3/
|
---|
| 8 | shift
|
---|
| 9 | shift
|
---|
| 10 | shift
|
---|
| 11 |
|
---|
| 12 | case $0 in
|
---|
| 13 | *uninstall*)
|
---|
| 14 | if test ! -d "$DESTDIR/$MSGDIR"; then
|
---|
| 15 | echo "Directory $DESTDIR/$MSGDIR does not exist! "
|
---|
| 16 | echo "Do a "make installmsg" or "make install" first. "
|
---|
| 17 | exit 1
|
---|
| 18 | fi
|
---|
| 19 | mode='uninstall'
|
---|
| 20 | ;;
|
---|
| 21 | *) mode='install' ;;
|
---|
| 22 | esac
|
---|
| 23 |
|
---|
| 24 | for f in $SRCDIR/po/*.msg; do
|
---|
| 25 | FNAME="$DESTDIR/$MSGDIR/`basename $f`"
|
---|
| 26 | if test "$mode" = 'install'; then
|
---|
| 27 | echo "Installing $f as $FNAME "
|
---|
| 28 | cp "$f" "$FNAME"
|
---|
| 29 | if test ! -f "$FNAME"; then
|
---|
| 30 | echo "Cannot install $FNAME. Does $USER have privileges? "
|
---|
| 31 | exit 1
|
---|
| 32 | fi
|
---|
| 33 | chmod 0644 "$FNAME"
|
---|
| 34 | elif test "$mode" = 'uninstall'; then
|
---|
| 35 | echo "Removing $FNAME "
|
---|
| 36 | rm -f "$FNAME"
|
---|
| 37 | if test -f "$FNAME"; then
|
---|
| 38 | echo "Cannot remove $FNAME. Does $USER have privileges? "
|
---|
| 39 | exit 1
|
---|
| 40 | fi
|
---|
| 41 | else
|
---|
| 42 | echo "Unknown mode, $mode. Script called as $0 "
|
---|
| 43 | exit 1
|
---|
| 44 | fi
|
---|
| 45 | done
|
---|
| 46 |
|
---|
| 47 | if test "$mode" = 'install'; then
|
---|
| 48 | cat << EOF
|
---|
| 49 | ==============================================================================
|
---|
| 50 | The SWAT msg files have been installed. You may uninstall the msg files using
|
---|
| 51 | the command "make uninstallmsg" or "make uninstall" to uninstall binaries, man
|
---|
| 52 | pages, msg files, and shell scripts.
|
---|
| 53 | ==============================================================================
|
---|
| 54 | EOF
|
---|
| 55 | else
|
---|
| 56 | cat << EOF
|
---|
| 57 | =============================================================================
|
---|
| 58 | The SWAT msg files have been removed. You may restore these files using the
|
---|
| 59 | command "make installmsg" or "make install" to install binaries, man pages,
|
---|
| 60 | modules, msg files, and shell scripts.
|
---|
| 61 | ======================================================================
|
---|
| 62 | EOF
|
---|
| 63 | fi
|
---|
| 64 |
|
---|
| 65 | exit 0
|
---|