-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·69 lines (62 loc) · 1.64 KB
/
install.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
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
64
65
66
67
68
69
#!/bin/bash
path="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
working_path="$path"
source "$working_path/app/common.sh"
if [ $(grep -c 'export PATH=~/.local/bin:$PATH' ~/.bashrc) -eq 0 ]; then
echo 'export PATH=~/.local/bin:$PATH' >>~/.bashrc
export PATH="$HOME/.local/bin:$PATH"
fi
if [ $# -eq 0 ]; then
install_dir=("$(find . -maxdepth 1 -type d -not -name "scripts" | sed 's/\.\///g' | sed 's/\..*//g')")
for dir in ${install_dir[@]}; do
if [ -f ${path}/${dir}/install.sh ] && ! ${working_path}/${dir}/install.sh; then
display_error "Install $dir failed."
exit 1
fi
done
exit 0
fi
while [ $# -ne 0 ]; do
case $1 in
--help | -h)
echo "Usage: $0 [options]"
echo "Options:"
echo " --help, -h Display this help message."
echo " --tools, -t Install tools."
echo " --prj, -p Install project."
echo " --app, -a Install app."
exit 0
;;
--tools | -t)
if ! $working_path/tools/install.sh; then
display_error "Install tools failed."
exit 1
fi
shift
;;
--prj | -p)
if ! $working_path/prj/install.sh; then
display_error "Install project failed."
exit 1
fi
shift
;;
--app | -a)
if ! $working_path/app/install.sh; then
display_error "Install app failed."
exit 1
fi
shift
;;
*)
echo "Usage: $0 [options]"
echo "Options:"
echo " --help, -h Display this help message."
echo " --tools, -t Install tools."
echo " --prj, -p Install project."
echo " --app, -a Install app."
exit 0
;;
esac
done
exit 0