-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
install.sh
executable file
·51 lines (44 loc) · 1.16 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
#!/bin/bash
DESTDIR=$1
BIN_FILE="bin/sar2"
DATA_FOLDER="data"
MAN_FOLDER="man"
ICON_FILE="extra/sar2.xpm"
DESKTOP_FILE="extra/sar2.desktop"
DATA_PATH="$DESTDIR/usr/share/sar2"
GAME_PATH="$DESTDIR/usr/bin/sar2"
MAN_PATH="$DESTDIR/usr/share/man/man6"
if [[ ! -f $BIN_FILE ]]
then
echo "You need to compile Search And Rescue II first"
exit 1
fi
data_location=`dirname $DATA_PATH`
game_location=`dirname $GAME_PATH`
if [[ ! -w $game_location || ! -w $data_location ]]
then
echo "You do not have permission to install the"
echo "the game in $game_location and $data_location."
echo "Are you root?"
exit 1
fi
if [[ -d $DATA_PATH ]]
then
echo "Cleaning older data files..."
rm -rf $DATA_PATH
fi
echo "Creating data folder..."
mkdir -p $DATA_PATH
echo "Copying data..."
cp -r $DATA_FOLDER/* $DATA_PATH
echo "Installing manual..."
mkdir -p $MAN_PATH
cp $MAN_FOLDER/* $MAN_PATH
echo "Installing sar2..."
mkdir -p `dirname $GAME_PATH`
cp $BIN_FILE $GAME_PATH
echo "Installing icon..."
xdg-icon-resource install --novendor --size 48 $ICON_FILE
echo "Installing menu entry..."
xdg-desktop-menu install --novendor $DESKTOP_FILE
echo "Installation successful"