: bharatvaj/forwarder

commit 0537cbff807d36bffbe28418061cb01d7615db2b
parent 406cbdd6efec1a43aa07f3fb5021546f93ae2121
Author: Bharatvaj H <bharatvajph@gmail.com>
Date: Thu, 14 Feb 2019 22:08:28 +0000

Adapted depinstall.sh for Arch Linux
1 file changed, 42 insertions(+), 19 deletions(-)
M
depinstall.sh
|
61
++++++++++++++++++++++++++++++++++++++++++-------------------
diff --git a/depinstall.sh b/depinstall.sh
@@ -1,26 +1,48 @@
 #!/bin/bash
-#todo ask password firsthand
 
-install() {
+#global vars
+installPath=deps
+
+if [ "$EUID" -ne 0 ]
+  then echo "Root previliges required"
+  exit
+fi
+
+mkdir -p $installPath
+cd $installPath
+
+cloneAndInstall() {
     str=${1##*/}
-    git clone $1 deps/$str
-    #fixme
-    cd deps/$str && cmake -DBUILD_SHARED_LIBS=ON . && make && sudo make install && cd ..
+    git clone $1 $str
+	makeAndInstall $str
+}
+
+makeAndInstall() {
+    cd $1 && cmake -DBUILD_SHARED_LIBS=ON . && make && make install && cd ..
 }
 
-#fixme support for arch
-apt install bluez bluz-tools bluez-hcidump build-essential libmnl0 libmnl-dev cmake make
-if [ $? -neq 0 ]; then
-	sudo apt install wget
-	wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz
-	tar -xvf Downloads/bluez-5.50.tar.xz
-	sudo apt install libdbus-1-dev libudev-dev libical-dev libbluetooth-dev
-	cd bluez-5.50/ && ./configure && make && sudo make install
+configureAndInstall() {
+	cd $1 && ./configure && make && make install && cd ..
+}
+
+if [ -f /etc/arch-release ]; then
+	pacman -Sy base-devel bluez bluez-libs libmnl
+else
+	apt install bluez bluez-tools bluez-hcidump build-essential libmnl0 libmnl-dev libbluetooth-dev
 fi
 
-install https://github.com/bmegli/wifi-scan
-install https://github.com/bharatvaj/clog
-install https://github.com/bharatvaj/libcomm
-install https://bitbucket.org/solo-1/forwarder
-install https://bitbucket.org/solo-1/left_initiator
-install https://bitbucket.org/solo-1/right_initiator
+if [ $? -ne 0 ]; then
+	echo "Dep installation failed, try updating your OS"
+	exit
+fi
+
+# download and install bluez manually(on error) for ubuntu
+# sudo apt install libdbus-1-dev libudev-dev libical-dev 
+# wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz
+# tar -xvf bluez-5.50.tar.xz
+# configureAndInstall bluez-5.50
+
+#TODO add branch hash
+cloneAndInstall https://github.com/bmegli/wifi-scan
+cloneAndInstall https://github.com/bharatvaj/clog
+cloneAndInstall https://github.com/bharatvaj/libcomm+
\ No newline at end of file