-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib_manager
More file actions
executable file
·50 lines (40 loc) · 1.25 KB
/
lib_manager
File metadata and controls
executable file
·50 lines (40 loc) · 1.25 KB
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
#!/bin/bash
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
GRAY='\033[0;37m'
ROOT_DIR="$(pwd)"
[[ $# -gt 1 ]] && libraries="${*:2}" || libraries="Logs CAN/Raspberry XBee"
for lib in $libraries; do
[[ ! -d "$lib" ]] && echo -e "${RED}Le dossier \"$lib\" n'existe pas${NC}" && continue
[[ ! -f "$lib"/CMakeLists.txt ]] && echo -e "${RED}Le dossier \"$lib\" ne contient pas de librairie${NC}" && continue
done
case $1 in
install|force-install)
for lib in $libraries; do
cd "$lib" || exit
[[ -d build && $1 == "force-install" ]] && yes|rm -r build
[[ ! -d build ]] && mkdir build
cd build || exit
cmake ..
sudo make install && echo -e "${GREEN}La librairie \"$lib\" a été installée${NC}"
cd "$ROOT_DIR" || exit
done
;;
pull|force-pull)
for lib in $libraries; do
cd "$lib" || exit
[[ -d build && $1 == "force-pull" ]] && yes|rm -r build
[[ ! -d build ]] && mkdir build
cd build
git pull
cmake ..
sudo make install && echo -e "${GREEN}La librairie \"$lib\" a été mise à jour${NC}"
cd "$ROOT_DIR" || exit
done
;;
*)
echo -e "${RED}Utilisation :${NC} lib_manager [install|force-install|pull|force_pull] ${GRAY}<...libs>${NC}"
exit 1
;;
esac