-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.sh
executable file
·57 lines (43 loc) · 1.17 KB
/
setup.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
#!/bin/sh
HERE="$HOME/Dockerfiles"
CONFIG_PATH="$HERE/.config"
SETUP_SCRIPTS_DIR="$HERE/.setup_scripts"
BIN="$HERE/bin"
HOME_BIN="$HOME/.bin/docker_bin"
FORCE="false"
source "$HERE/version.sh"
main(){
local link_cmd="ln -sv"
while [ "$1" != "" ]; do
case "$1" in
-f | --force )
link_cmd="$link_cmd -f"
FORCE="true"
;;
-v | --version )
echo "${VERSION}"
exit 0
;;
* )
;;
esac
shift
done
export CONFIG_PATH="$CONFIG_PATH"
if ! [ -d "$HOME_BIN" ]; then
mkdir "$HOME_BIN"
fi
for file in "$BIN"/*; do
if [ -f "$file" ]; then
local file_name_with_ext="${file##*/}"
local file_name="${file_name_with_ext%.*}"
if [ "$FORCE" == "false" ] && ! [ -f "$HOME_BIN/$file_name" ]; then
eval "$link_cmd $file $HOME_BIN/$file_name"
elif [ "$FORCE" == "true" ]; then
eval "$link_cmd $file $HOME_BIN/$file_name"
fi
fi
done
source "$SETUP_SCRIPTS_DIR/git_flow.sh"
}
main "$@"