Rename some variables in getpwnam_alloc() for clarity
[Samba/bb.git] / source / script / installmo.sh
bloba1f9c58e275ed6d9b08e185e556304d5e8f06264
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 FNAME="$DESTDIR/$LOCALEDIR/$LANGUAGE/LC_MESSAGES/$MODULE.mo"
28 if test ! -d "$DESTDIR/$LOCALEDIR/$LANGUAGE/LC_MESSAGES/"; then
29 mkdir -p "$DESTDIR/$LOCALEDIR/$LANGUAGE/LC_MESSAGES/"
31 if test "$mode" = 'install'; then
32 echo "Installing $f as $FNAME"
33 touch "$FNAME"
34 $MSGFMT "$f" -f -o "$FNAME"
35 if test ! -f "$FNAME"; then
36 echo "Cannot install $FNAME. Does $USER have privileges?"
37 exit 1
39 chmod 0644 "$FNAME"
40 elif test "$mode" = 'uninstall'; then
41 echo "removing $FNAME"
42 rm -f "$FNAME"
43 if test -f "$FNAME"; then
44 echo "Cannot remove $FNAME. Does $USER have privileges?"
45 exit 1
47 else
48 echo "Unknown mode $mode. script called as $0."
49 exit 1
51 done
52 if test "$mode" = 'install'; then
53 cat << EOF
54 ==============================================================
55 MO files for $MODULE are installed.
56 ==============================================================
57 EOF
58 else
59 cat << EOF
60 ==============================================================
61 MO files for $MODULE are removed.
62 ==============================================================
63 EOF
65 done
67 if test "$mode" = 'install'; then
68 cat << EOF
69 ==============================================================
70 All MO files for Samba are installed. You can use "make uninstall"
71 or "make uninstallmo" to remove them.
72 ==============================================================
73 EOF
74 else
75 cat << EOF
76 ==============================================================
77 All MO files for Samba are removed. you can use "make install"
78 or "make installmo" to install them.
79 ==============================================================
80 EOF
83 exit 0