: bharatvaj/forwarder

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
#!/bin/bash

#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 $str
	makeAndInstall $str
}

makeAndInstall() {
    cd $1 && cmake -DBUILD_SHARED_LIBS=ON . && make && make install && cd ..
}

makeBuild() {
    cd $1 && cmake -DBUILD_SHARED_LIBS=ON . && make && cd ..
}

configureAndInstall() {
	cd $1 && ./configure && make && make install && cd ..
}

downloadAndInstallXBee() {
	url=https://github.com/digidotcom/xbee_ansic_library 
	str=${url##*/}
	git clone $url $str
	cp ../3rdparty/xbee/CMakeLists.txt $str/CMakeLists.txt
	makeBuild $str
}

if [ -f /etc/arch-release ]; then
	pacman -Syu --needed base-devel bluez bluez-libs libmnl
else
	apt install bluez bluez-tools bluez-hcidump build-essential libmnl0 libmnl-dev libbluetooth-dev cmake make
fi

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
downloadAndInstallXBee
cloneAndInstall https://github.com/bharatvaj/EventManager
cloneAndInstall https://github.com/bharatvaj/Dot