aboutsummaryrefslogtreecommitdiffhomepage
path: root/installer.sh
diff options
context:
space:
mode:
authorSpacelord <Spacelord09@users.noreply.github.com>2019-12-06 19:58:16 +0100
committerSpacelord <Spacelord09@users.noreply.github.com>2019-12-06 19:58:16 +0100
commit2cb91753b2cab927fca9107128519872ac70665d (patch)
treeec4e27fb9e2ef8fcd73f1d618a36ababb01ea285 /installer.sh
parent01c8635205e25ba2e6c128010ad512cf03868bc2 (diff)
downloadmidimonster-2cb91753b2cab927fca9107128519872ac70665d.tar.gz
midimonster-2cb91753b2cab927fca9107128519872ac70665d.tar.bz2
midimonster-2cb91753b2cab927fca9107128519872ac70665d.zip
Initial installer release
Diffstat (limited to 'installer.sh')
-rw-r--r--installer.sh109
1 files changed, 109 insertions, 0 deletions
diff --git a/installer.sh b/installer.sh
new file mode 100644
index 0000000..fa898fb
--- /dev/null
+++ b/installer.sh
@@ -0,0 +1,109 @@
+#!/bin/bash
+
+################################################ SETUP ################################################
+deps=(libasound2-dev libevdev-dev liblua5.3-dev libola-dev libjack-jackd2-dev pkg-config libssl-dev gcc make wget git)
+user=$(whoami) # for bypassing user check replace "$(whoami)" with "root".
+
+script_path="`cd $0; pwd`" # Script dir
+tmp_path=$(mktemp -d) # Repo download path
+
+Iversion="v0.2" # (fallback version if )
+makeargs=full # Build args
+
+VAR_DESTDIR="" # Unused
+VAR_PREFIX="/usr"
+VAR_PLUGINS="$VAR_PREFIX/lib/midimonster"
+VAR_DEFAULT_CFG="/etc/midimonster/midimonster.cfg"
+VAR_EXAMPLE_CFGS="$VAR_PREFIX/share/midimonster"
+
+################################################ SETUP ################################################
+
+############################################## FUNCTIONS ##############################################
+
+INSTALL-DEPS () { ##Install deps from array "$deps"
+for t in ${deps[@]}; do
+ if [ $(dpkg-query -W -f='${Status}' $t 2>/dev/null | grep -c "ok installed") -eq 0 ];
+ then
+ echo "Installing "$t"";
+ apt-get install $t -Y;
+ echo "Done.";
+ else
+ echo ""$t" already installed!"
+
+ fi
+done
+echo ""
+}
+
+INSTALL-PREP () {
+ echo "Starting Git!"
+ git clone https://github.com/cbdevnet/midimonster.git "$tmp_path" # Gets Midimonster
+ Iversion=(git describe --abbrev=0) # Get last tag(stable version)
+ echo "Starting Git checkout to "$Iversion""
+ git checkout $Iversion $tmp_path
+
+ echo ""
+
+ read -e -i "$VAR_PREFIX" -p "PREFIX (Install root directory): " input # Reads VAR_PREFIX
+ VAR_PREFIX="${input:-$VAR_PREFIX}"
+
+ read -e -i "$VAR_PLUGINS" -p "PLUGINS (Plugin directory): " input # Reads VAR_PLUGINS
+ VAR_PLUGINS="${input:-$VAR_PLUGINS}"
+
+ read -e -i "$VAR_DEFAULT_CFG" -p "Default config path: " input # Reads VAR_DEFAULT_CFG
+ VAR_DEFAULT_CFG="${input:-$VAR_DEFAULT_CFG}"
+
+ read -e -i "$VAR_EXAMPLE_CFGS" -p "Example config directory: " input # Reads VAR_EXAMPLE_CFGS
+ VAR_EXAMPLE_CFGS="${input:-$VAR_EXAMPLE_CFGS}"
+
+
+ export PREFIX=$VAR_PREFIX
+ export PLUGINS=$VAR_PLUGINS
+ export DEFAULT_CFG=$VAR_DEFAULT_CFG
+ export DESTDIR=$VAR_DESTDIR
+ export EXAMPLES=$VAR_EXAMPLE_CFGS
+}
+
+INSTALL-RUN () { # Build
+ cd "$tmp_path"
+ make clean
+ make $makeargs
+ make install
+}
+
+ERROR () {
+ echo "Aborting..."
+ CLEAN
+ exit 1
+}
+
+DONE () {
+ echo Done.
+ CLEAN
+ exit 0
+}
+
+CLEAN () {
+ echo "Cleaning..."
+ rm -rf $tmp_path
+}
+
+############################################## FUNCTIONS ##############################################
+
+
+################################################ Main #################################################
+
+trap ERROR SIGINT SIGTERM SIGKILL
+clear
+
+if [ $user != "root" ]; then # Check if $user = root!
+ echo "Installer must be run as root"
+ ERROR
+fi
+
+if [ $(wget -q --spider http://github.com) $? -eq 0 ]; then "INSTALL-DEPS"; else echo You need connection to the internet; ERROR ; fi
+
+INSTALL-PREP
+echo ""
+INSTALL-RUN
+DONE \ No newline at end of file