Browse Source

Slightly nicer way to get the BASEDIR

Change-Id: I10d6bfe317653881e4b0af603d44ce2a6a435004
Reviewed-on: http://gerrit.dmdirc.com/1276
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4rc1
Shane Mc Cormack 14 years ago
parent
commit
ad30b96580

+ 1
- 9
installer/linux/getjre.sh View File

27
 fi
27
 fi
28
 
28
 
29
 # Find out where we are
29
 # Find out where we are
30
-BASEDIR=${0%/*}
31
-if [ "${BASEDIR}" = "${0}" ]; then
32
-	BASEDIR=`which $0`
33
-	BASEDIR=${BASEDIR%/*}
34
-fi
35
-CHECKBASEDIR=`echo "${BASEDIR}" | sed 's#^/##'`
36
-if [ "${CHECKBASEDIR}" = "${BASEDIR}" ]; then
37
-	BASEDIR=${PWD}/${BASEDIR}
38
-fi;
30
+BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
39
 
31
 
40
 PIDOF=`which pidof`
32
 PIDOF=`which pidof`
41
 if [ "${PIDOF}" = "" ]; then
33
 if [ "${PIDOF}" = "" ]; then

+ 1
- 9
installer/linux/installjre.sh View File

42
 fi
42
 fi
43
 
43
 
44
 # Find out where we are
44
 # Find out where we are
45
-BASEDIR=${0%/*}
46
-if [ "${BASEDIR}" = "${0}" ]; then
47
-	BASEDIR=`which $0`
48
-	BASEDIR=${BASEDIR%/*}
49
-fi
50
-CHECKBASEDIR=`echo "${BASEDIR}" | sed 's#^/##'`
51
-if [ "${CHECKBASEDIR}" = "${BASEDIR}" ]; then
52
-	BASEDIR=${PWD}/${BASEDIR}
53
-fi;
45
+BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
54
 
46
 
55
 PIDOF=`which pidof`
47
 PIDOF=`which pidof`
56
 if [ "${PIDOF}" = "" ]; then
48
 if [ "${PIDOF}" = "" ]; then

+ 1
- 9
installer/linux/setup.sh View File

47
 fi
47
 fi
48
 
48
 
49
 # Find out where we are
49
 # Find out where we are
50
-BASEDIR=${0%/*}
51
-if [ "${BASEDIR}" = "${0}" ]; then
52
-	BASEDIR=`which $0`
53
-	BASEDIR=${BASEDIR%/*}
54
-fi
55
-CHECKBASEDIR=`echo "${BASEDIR}" | sed 's#^/##'`
56
-if [ "${CHECKBASEDIR}" = "${BASEDIR}" ]; then
57
-	BASEDIR=${PWD}/${BASEDIR}
58
-fi;
50
+BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
59
 
51
 
60
 PIDOF=`which pidof`
52
 PIDOF=`which pidof`
61
 if [ "${PIDOF}" = "" ]; then
53
 if [ "${PIDOF}" = "" ]; then

+ 1
- 9
installer/linux/uninstall.sh View File

24
 fi
24
 fi
25
 
25
 
26
 # Find out where we are
26
 # Find out where we are
27
-BASEDIR=${0%/*}
28
-if [ "${BASEDIR}" = "${0}" ]; then
29
-	BASEDIR=`which $0`
30
-	BASEDIR=${BASEDIR%/*}
31
-fi
32
-CHECKBASEDIR=`echo "${BASEDIR}" | sed 's#^/##'`
33
-if [ "${CHECKBASEDIR}" = "${BASEDIR}" ]; then
34
-	BASEDIR=${PWD}/${BASEDIR}
35
-fi;
27
+BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
36
 
28
 
37
 if [ ! -e ${BASEDIR}/.uninstall.conf ]; then
29
 if [ ! -e ${BASEDIR}/.uninstall.conf ]; then
38
 	echo "No .uninstall.conf found, unable to continue."
30
 	echo "No .uninstall.conf found, unable to continue."

+ 1
- 9
launcher/unix/DMDirc.sh View File

52
 fi
52
 fi
53
 
53
 
54
 # Find out where we are
54
 # Find out where we are
55
-BASEDIR=${0%/*}
56
-if [ "${BASEDIR}" = "${0}" ]; then
57
-	BASEDIR=`which $0`
58
-	BASEDIR=${BASEDIR%/*}
59
-fi
60
-CHECKBASEDIR=`echo "${BASEDIR}" | sed 's#^/##'`
61
-if [ "${CHECKBASEDIR}" = "${BASEDIR}" ]; then
62
-	BASEDIR=${PWD}/${BASEDIR}
63
-fi;
55
+BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
64
 
56
 
65
 # Store params so that we can pass them back to the client
57
 # Store params so that we can pass them back to the client
66
 for param in "$@"; do
58
 for param in "$@"; do

+ 1
- 10
updateBundledPlugins.sh View File

5
 # the names and versions to the jar's version.config file.
5
 # the names and versions to the jar's version.config file.
6
 
6
 
7
 # Find out where we are
7
 # Find out where we are
8
-BASEDIR=${0%/*}
9
-if [ "${BASEDIR}" = "${0}" ]; then
10
-	BASEDIR=`which $0`
11
-	BASEDIR="${BASEDIR%/*}"
12
-fi
13
-CHECKBASEDIR=`echo "${BASEDIR}" | sed 's#^/##'`
14
-
15
-if [ "${CHECKBASEDIR}" = "${BASEDIR}" -a "${PWD}" != "${CHECKBASEDIR}" -a "${PWD}/." != "${CHECKBASEDIR}" ]; then
16
-	BASEDIR="${PWD}/${BASEDIR}"
17
-fi;
8
+BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
18
 
9
 
19
 if [ -e "${BASEDIR}/build-functions.sh" ]; then
10
 if [ -e "${BASEDIR}/build-functions.sh" ]; then
20
 	. "${BASEDIR}/build-functions.sh"
11
 	. "${BASEDIR}/build-functions.sh"

Loading…
Cancel
Save