]> git.siccegge.de Git - ghextris.git/blob - install.sh
clean up imports
[ghextris.git] / install.sh
1 #!/bin/sh
2
3 if [ "f$1" == f ]; then
4 echo "usage: $0 prefix [real_prefix]"
5 echo
6 echo "where prefix is the directory under which to install (eg. /usr, /usr/local)"
7 echo "and real_prefix is the directory under which the program is eventually"
8 echo "to run (the same as prefix by default)."
9 echo "You probably don't want to touch the latter by hand."
10 echo
11 exit
12 fi
13
14 PREFIX="$1"
15 BINDIR="$PREFIX/games"
16 MANDIR="$PREFIX/share/man/man6"
17 SHAREDIR="$PREFIX/share/games/ghextris"
18 LOCALEDIR="$PREFIX/share/locale"
19 APPDIR="$PREFIX/share/applications"
20
21 if [ "f$2" == f ]; then
22 REALPREFIX="$PREFIX"
23 else
24 REALPREFIX="$2"
25 fi
26
27 REALSHAREDIR="$REALPREFIX/share/games/ghextris"
28
29 umask 022
30
31 echo "Installing program files"
32
33 mkdir -m 755 -p "$BINDIR" || exit 1
34 mkdir -m 755 -p "$SHAREDIR" || exit 1
35 mkdir -m 755 -p "$APPDIR" || exit 1
36 mkdir -m 755 -p "$MANDIR" || exit 1
37
38 sed "s#^SHAREDIR.*#SHAREDIR = \"$REALSHAREDIR\"#" < ghextris.py > "$SHAREDIR/ghextris.py" || exit 1
39 chmod 755 "$SHAREDIR/ghextris.py"
40 sed "s#^Icon=.*#Icon=$REALSHAREDIR/ghextris.png#" < ghextris.desktop > "$APPDIR/ghextris.desktop" || exit 1
41 chmod 644 "$APPDIR/ghextris.desktop"
42
43 cp ghextris.glade "$SHAREDIR" || exit 1
44 cp ghextris.png "$SHAREDIR" || exit 1
45 cp ghextris-icon.xpm "$SHAREDIR" || exit 1
46 cp ghextris.man "$MANDIR/ghextris.6" || exit 1
47
48 # We just link the .py into the games directory for now; in the future,
49 # this step may be replaced by optional installation of a setgid games
50 # wrapper program for scorekeeping
51 ln -sf ../share/games/ghextris/ghextris.py "$BINDIR"/ghextris || exit 1
52
53 echo "Checking for msgfmt"
54
55 if which msgfmt > /dev/null; then
56 echo "msgfmt found, installing translations"
57
58 for a in po/*.po; do
59 LANG="`basename $a .po`"
60 echo "- Language $a"
61 mkdir -m 755 -p "$LOCALEDIR/$LANG/LC_MESSAGES"
62 msgfmt -o "$LOCALEDIR/$LANG/LC_MESSAGES/ghextris.mo" "$a" || exit 1
63 done
64 else
65 echo "msgfmt not found; translations not installed"
66 fi
67
68 echo "Done."