s3-waf: create a smbldap.so library.
[Samba/id10ts.git] / source3 / script / installmo.sh
blob5ca3371d80ecbbba993fc617d1ec0ddd731fc4b3
1 #!/bin/sh
3 DESTDIR=$1
4 LOCALEDIR=`echo $2 | sed 's/\/\//\//g'`
5 SRCDIR=$3/
6 MSGFMT=msgfmt
8 case $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
15 mode='uninstall'
18 mode='install'
20 esac
22 for 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
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/"
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
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
51 else
52 echo "Unknown mode $mode. script called as $0."
53 exit 1
55 done
56 if test "$mode" = 'install'; then
57 cat << EOF
58 ==============================================================
59 MO files for $MODULE are installed.
60 ==============================================================
61 EOF
62 else
63 cat << EOF
64 ==============================================================
65 MO files for $MODULE are removed.
66 ==============================================================
67 EOF
69 done
71 if test "$mode" = 'install'; then
72 cat << EOF
73 ==============================================================
74 All MO files for Samba are installed. You can use "make uninstall"
75 or "make uninstallmo" to remove them.
76 ==============================================================
77 EOF
78 else
79 cat << EOF
80 ==============================================================
81 All MO files for Samba are removed. you can use "make install"
82 or "make installmo" to install them.
83 ==============================================================
84 EOF
87 exit 0