summaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..2727a86
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+installBinary() {
+ builddir="${1}"
+ bindir="${2}"
+
+ mkdir -pvm755 "${bindir}"
+
+ install -vm755 "${builddir}/bowshock/bowshock" "${bindir}"/bowshock
+}
+
+installData() {
+ srcdir="${1}"
+ datdir="${2}"
+
+ mkdir -pvm755 "${datdir}/shaders"
+
+ install -vm644 "${srcdir}/CHANGELOG.txt" "${datdir}"
+ install -vm644 "${srcdir}/CREDITS.txt" "${datdir}"
+ install -vm644 "${srcdir}/bowshock/shader/"*".glsl" "${datdir}/shaders"
+}
+
+if [ "${1}" == "data" ]
+then
+ echo installing data...
+
+ if [ -z "${2}" ]
+ then
+ echo failure: data directory is not set
+ exit 2
+ fi
+
+ srcdir="${PWD}"
+ datdir="${2}"
+
+ installData "${srcdir}" "${datdir}"
+
+ echo done
+
+ exit 0
+fi
+
+echo installing all...
+
+if [ -z "${1}" ]
+then
+ echo failure: build directory is not set
+ exit 3
+fi
+
+if [ -z "${2}" ]
+then
+ echo failure: binary directory is not set
+ exit 2
+fi
+
+if [ -z "${3}" ]
+then
+ echo failure: data directory is not set
+ exit 1
+fi
+
+srcdir="${PWD}"
+builddir="${1}"
+bindir="${2}"
+datdir="${3}"
+
+installBinary "${builddir}" "${bindir}"
+installData "${srcdir}" "${datdir}"
+
+echo done