/
install.sh
executable file
·116 lines (98 loc) · 2.04 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env bash
function ascii(){
{
cat << ASCII
##########################################
__ _ __
___ _ ____ __/ /_(_) /____
/ _ \| |/_/ / / / __/ / / ___/
/ __/> </ /_/ / /_/ / (__ )
\___/_/|_|\__,_/\__/_/_/____/
##########################################
Copyright (C) 2019 redpeacock78
License GPLv3+: GNU GPL version3 or later.
##########################################
ASCII
}
}
function install(){
{
mkdir -p ~/.exutils/bin && \
cp $(pwd)/bin/* ~/.exutils/bin
}
}
function docker_install(){
{
mkdir -p ~/.exutils/bin && \
cp ~/exutils/bin/* ~/.exutils/bin && \
cp ~/exutils/docker/bin/* ~/.exutils/bin
}
}
function update(){
{
cp -f $(pwd)/bin/* ~/.exutils/bin
}
}
function uninstall(){
{
rm -rf ~/.exutils
}
}
function path(){
{
cat << "PATH"
Add ~/.exutils/bin to your $PATH for access to the exutils command-line utility.
For bash:
echo 'export PATH="$HOME/.exutils/bin:$PATH"' >> ~/.bashrc
For zsh:
echo 'export PATH="$HOME/.exutils/bin:$PATH"' >> ~/.zshrc
PATH
}
}
function usage(){
{
cat << EOS >&2
Usage: install.sh [--docker] [--update] [--uninstall] [-h,--help]
EOS
}
}
function error(){
{
cat << EOS >&2
Error.
Refer '${0##*/} -h' or '${0##*/} --help' for how to use the command.
EOS
}
}
function separete_opt(){
if [[ -z "${@}" ]]; then
ascii && \
echo 'Installation start ...' && \
install && \
echo 'Done!' && \
path
elif [[ "${@}" == --docker ]]; then
ascii && \
echo 'Installation start ...' && \
echo 'For Docker ...' && \
docker_install && \
echo 'Done!' && \
path
elif [[ "${@}" == --update ]]; then
ascii && \
echo 'Update start ...' && \
update && \
echo 'Done!'
elif [[ "${@}" == --uninstall ]]; then
ascii && \
echo 'Uninstallation start ...' && \
uninstall && \
echo 'Done!'
elif [[ "${@}" == -h ]]|| \
[[ "${@}" == --help ]]; then
usage
else
error
fi
}
separete_opt "${@}"