summaryrefslogtreecommitdiff
path: root/build.sh
blob: e6c563b83188d9e51ae920e45e563eacb69d471d (plain)
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

MINZ_REPO_URL="https://github.com/marienfressinaud/MINZ.git"
MINZ_CLONE_PATH="./minz_tmp"
LIB_MINZ_PATH="./minz_tmp/lib/*"
LIB_PATH="./lib/minz"
LOG_PATH="./log"
CACHE_PATH="./cache"

git_check() {
	printf "Vérification de la présence de git... "

	EXE_PATH=$(which "git" 2>/dev/null)
	if [ $? -ne 0 ]; then
		printf "git n'est pas présent sur votre système. Veuillez l'installer avant de continuer\n";
		exit 1
	else
		printf "git a été trouvé\n"
	fi
}

dir_check() {
	test -d $LOG_PATH
	if [ $? -ne 0 ]; then
		mkdir $LOG_PATH
	fi

	test -d $CACHE_PATH
	if [ $? -ne 0 ]; then
		mkdir $CACHE_PATH
	fi
}

clone_minz() {
	printf "Récupération de Minz...\n"

	git clone $MINZ_REPO_URL $MINZ_CLONE_PATH
	test -d $LIB_PATH
	if [ $? -ne 0 ]; then
		mkdir -p $LIB_PATH
	fi
	mv $LIB_MINZ_PATH $LIB_PATH
	rm -rf $MINZ_CLONE_PATH

	printf "Récupération de Minz terminée...\n"
}

git_check
dir_check
clone_minz