-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·32 lines (27 loc) · 922 Bytes
/
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
#!/usr/bin/env sh
if [ -z "$1" ]; then
export PREFIX=/usr
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
else
export PREFIX=$1
fi
echo "Installing to prefix ${PREFIX}"
# Compile po files
echo "Copying and installing localization files"
for f in po/*.po; do
echo "Processing $f"
LOCALE=$(basename "$f" .po)
mkdir -p ${PREFIX}/share/locale/${LOCALE}/LC_MESSAGES
msgfmt $f -o ${PREFIX}/share/locale/${LOCALE}/LC_MESSAGES/vgrep.mo
done
# Generate desktop file
msgfmt --desktop --template=pkg/desktop/com.gexperts.VisualGrep.desktop.in -d po -o pkg/desktop/com.gexperts.VisualGrep.desktop
# Copy executable and desktop file
mkdir -p ${PREFIX}/bin
cp vgrep ${PREFIX}/bin/vgrep
mkdir -p ${PREFIX}/share/applications
cp pkg/desktop/com.gexperts.VisualGrep.desktop ${PREFIX}/share/applications