-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager.sh
37 lines (32 loc) · 883 Bytes
/
manager.sh
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
#!/bin/bash
# usage: dpkg_check "libname"
dpkg_check() {
dpkg -s $1 >/dev/null 2>&1 && installed=true || installed=false
if [ "$installed" == false ]; then
apt update > /dev/null 2>&1
apt install $1 > /dev/null 2>&1
fi
}
# automatic compilation and configuration from a clone of a repository
# usage: git_install "https://github.com/username/name.git" "name"
git_install() {
if ! git --version > /dev/null 2>&1; then
apt update > /dev/null 2>&1
apt install git -y > /dev/null 2>&1
fi
if ! cmake --version > /dev/null 2>&1; then
apt update > /dev/null 2>&1
apt install cmake -y > /dev/null 2>&1
fi
if [ ! -d "$2" ]; then
git clone "$1" "$2"
cd $2
git submodule update --init
mkdir build
cd build
cmake ..
make && sudo make install
else
echo -e "error: $(pwd)/$2 this clone already exists"
fi
}