Subversion Repositories vaca_plus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 h266 1
#!/bin/bash
2
 
3
## stuff
4
SCRIPT_DIR="scripts"    # subdir to be installed
5
SRC_DIR="vaca_plus"     # subdir to be installed
6
INST_DIR="vaca_plus"    # what the subdir will be called in the EDuke32 dir
7
SYSTEM=`uname -s`
8
ARCH=`uname -a`
9
TMP="/tmp"
10
TOP_DIR=`pwd`
11
 
12
## constants
13
USER_PATH="~/.eduke32"
14
DUKE_PATH[]="/usr/local/games/eduke32"
15
DUKE_PATH[]="/usr/games/eduke32"
16
DUKE_PATH[]=$USER_PATH
17
UTIL_PATH=$TOP_DIR"/utils/"$SYSTEM"/"$ARCH
18
 
19
## check requirements
20
 
21
# check kextract
22
KEXTRACT=`whereis kextract`
23
if test "x$KEXTRACT" == "x"; then
24
        KEXTRACT=$UTIL_PATH"/kextract"
25
fi
26
 
27
# check unpackssi
28
KEXTRACT=`whereis unpackssi`
29
if test "x$KEXTRACT" == "x"; then
30
        KEXTRACT=$UTIL_PATH"/unpackssi"
31
fi
32
 
33
# check uips
34
KEXTRACT=`whereis uips`
35
if test "x$KEXTRACT" == "x"; then
36
        KEXTRACT=$UTIL_PATH"/uips"
37
fi
38
 
39
## check root or user
40
IS_USER="/bin/true"
41
if [[ `echo -n $UID` == "0" ]]; then
42
        IS_USER="/bin/false"
43
fi
44
 
45
## check arguments
46
 
47
## find install path
48
INSTALL_PATH=""
49
if $IS_USER; then
50
        INSTALL_PATH=$USER_PATH
51
else
52
        for (( i=0; $i < ${#DUKE_PATH}; i=$i+1 )); do
53
                if [[ -f ${DUKE_PATH[$i]}"/duke3d.grp" ]]; then
54
                        INSTALL_PATH=${DUKE_PATH[$i]}
55
                        continue
56
                fi
57
        done
58
fi
59
if test "x$INSTALL_PATH" == "x"; then
60
        echo "Could not locate EDuke32 installation." >&2
61
        exit -1
62
fi
63
 
64
## patch
65
TMP_PATH="$TMP/patch.$$"
66
mkdir $TMP_PATH
67
"$TOP_DIR/patch" "$TOP_DIR" "$SRC_DIR" "$TMP_PATH"
68
cp -R "$TMP_PATH/." "$TOP_DIR/$SRC_DIR/"
69
rm -rf $TMP_PATH
70
 
71
## install
72
 
73
cp -R "$TOP_DIR/$SRC_DIR" "$INSTALL_PATH/"
74
cp "$TOP_DIR/$SCRIPT_DIR/*" "$INSTALL_PATH/"
75