source: branches/samba-3.5.x/source3/script/installmo.sh@ 791

Last change on this file since 791 was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 2.2 KB
Line 
1#!/bin/sh
2
3DESTDIR=$1
4LOCALEDIR=`echo $2 | sed 's/\/\//\//g'`
5SRCDIR=$3/
6MSGFMT=msgfmt
7
8case $0 in
9 *uninstall*)
10 if test ! -d "$DESTDIR/$LOCALEDIR"; then
11 echo "Directory $DESTDIR/$LOCALEDIR doesn't exist!"
12 echo "Do a \"make installmo\" or \"make install\" first."
13 exit 1
14 fi
15 mode='uninstall'
16 ;;
17 *)
18 mode='install'
19 ;;
20esac
21
22for dir in $SRCDIR/locale/*; do
23 MODULE=`basename $dir`
24 for f in $SRCDIR/locale/$MODULE/*.po; do
25 BASE=`basename $f`
26 LANGUAGE=`echo $BASE | sed 's/\.po//g'`
27 if test "$LANGUAGE" = '*'; then
28 echo "No .po file exists!"
29 exit 0
30 fi
31 FNAME="$DESTDIR/$LOCALEDIR/$LANGUAGE/LC_MESSAGES/$MODULE.mo"
32 if test ! -d "$DESTDIR/$LOCALEDIR/$LANGUAGE/LC_MESSAGES/"; then
33 mkdir -p "$DESTDIR/$LOCALEDIR/$LANGUAGE/LC_MESSAGES/"
34 fi
35 if test "$mode" = 'install'; then
36 echo "Installing $f as $FNAME"
37 touch "$FNAME"
38 $MSGFMT -f -o "$FNAME" "$f"
39 if test ! -f "$FNAME"; then
40 echo "Cannot install $FNAME. Does $USER have privileges?"
41 exit 1
42 fi
43 chmod 0644 "$FNAME"
44 elif test "$mode" = 'uninstall'; then
45 echo "removing $FNAME"
46 rm -f "$FNAME"
47 if test -f "$FNAME"; then
48 echo "Cannot remove $FNAME. Does $USER have privileges?"
49 exit 1
50 fi
51 else
52 echo "Unknown mode $mode. script called as $0."
53 exit 1
54 fi
55 done
56 if test "$mode" = 'install'; then
57 cat << EOF
58==============================================================
59MO files for $MODULE are installed.
60==============================================================
61EOF
62 else
63 cat << EOF
64==============================================================
65MO files for $MODULE are removed.
66==============================================================
67EOF
68 fi
69done
70
71if test "$mode" = 'install'; then
72 cat << EOF
73==============================================================
74All MO files for Samba are installed. You can use "make uninstall"
75or "make uninstallmo" to remove them.
76==============================================================
77EOF
78else
79 cat << EOF
80==============================================================
81All MO files for Samba are removed. you can use "make install"
82or "make installmo" to install them.
83==============================================================
84EOF
85fi
86
87exit 0
Note: See TracBrowser for help on using the repository browser.