-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·113 lines (84 loc) · 2.91 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
PREFIX=/usr/local
SYSCONFDIR=/etc
JAVA_HOME=
usage() {
printf "Usage: %s [-p prefix] [-j javahome]\n" $0
}
#-----------------------------------------------------------------------------
# Parse options
#-----------------------------------------------------------------------------
while getopts hj:p: OPTION; do
case $OPTION in
h) usage; exit 0;;
j) JAVA_HOME="$OPTARG";;
p) PREFIX="$OPTARG";;
?) usage; exit 1;;
esac
done
shift `expr $OPTIND - 1`
if [ ! -z "$*" ]; then
usage
exit 1;
fi
if [ -z "$JAVA_HOME" ]; then
echo "Use option -j to specify the installation directory of a" >&2
echo "Java 1.5 compatible virtual machine" >&2
exit 1
fi
if [ ! -x "$JAVA_HOME/bin/java" ]; then
echo "$JAVA_HOME/bin/java does not exist or is not executable" >&2
exit 1
fi
#-----------------------------------------------------------------------------
# Install files
#-----------------------------------------------------------------------------
# Install files to $PREFIX/share/gogui/lib
install -d $PREFIX/share/gogui/lib
install -m 644 lib/*.jar $PREFIX/share/gogui/lib
# Install files to $PREFIX/bin
JAVA_DEFAULT="$JAVA_HOME/bin/java"
install -d $PREFIX/bin
for FILE in bin/*; do
if [ -f $FILE -a -x $FILE ]; then
cat $FILE \
| sed -e "s;^GOGUI_LIB=.*;GOGUI_LIB=\"$PREFIX/share/gogui/lib\";" \
-e "s;^JAVA_DEFAULT=.*;JAVA_DEFAULT=\"$JAVA_DEFAULT\";" \
> $PREFIX/$FILE
chmod a+x $PREFIX/$FILE
fi
done
# Install files to $PREFIX/share/doc/gogui
install -d $PREFIX/share/doc/gogui
install -m 644 doc/manual/html/*.html $PREFIX/share/doc/gogui
# Install files to $PREFIX/share/man
install -d $PREFIX/share/man/man1
install -m 644 doc/manual/man/*.1 $PREFIX/share/man/man1
# Install icons
xdg-icon-resource install --size 48 config/gogui-gogui.png
xdg-icon-resource install --size 48 --context mimetypes \
config/application-x-go-sgf.png
# Install desktop entry
xdg-desktop-menu install config/gogui-gogui.desktop
# Install shared mime info
xdg-mime install config/gogui-mime.xml
# Install Gnome thumbnailer
install -d $SYSCONFDIR/gconf/schemas
cat config/gogui.schemas \
| sed "s;/usr/bin/gogui-thumbnailer;$PREFIX/bin/gogui-thumbnailer;" \
> $SYSCONFDIR/gconf/schemas/gogui.schemas
# Install scrollkeeper entry
install -d $PREFIX/share/omf/gogui
cat config/gogui-C.omf \
| sed "s;file:/usr/;file:$PREFIX/;" \
> $PREFIX/share/omf/gogui/gogui-C.omf
#-----------------------------------------------------------------------------
# Post installation
# Fail quietly on error, some programs might not be available
#-----------------------------------------------------------------------------
# Update scrollkeeper.
scrollkeeper-update >/dev/null 2>&1
# Gnome thumbnailer
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule \
$SYSCONFDIR/gconf/schemas/gogui.schemas >/dev/null 2>&1