-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot
executable file
·94 lines (75 loc) · 1.84 KB
/
dot
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
#!/bin/bash
title(){
echo " __ __ ____ _ __ _ _ "
echo " | \/ |_ _ | _ \ ___ | |_ / _(_) | ___ ___ "
echo " | |\/| | | | | | | | |/ _ \| __| |_| | |/ _ \/ __| "
echo " | | | | |_| | | |_| | (_) | |_| _| | | __/\__ \ "
echo " |_| |_|\__, | |____/ \___/ \__|_| |_|_|\___||___/ "
echo " |___/ "
echo
}
_help(){
echo "Usage: $0 [options] <action> <module>"
echo
echo " <action> means: What do you want to do? (install or uninstall)"
echo " <module> means: The folder to be installed/uninstalled"
echo
echo " Options:"
echo " h Print this help"
echo " v Enable verbose"
echo
exit 0
}
run(){
mod=$1
action=$2
echo "Module $mod: $action"
source $PWD/$mod/module.sh
$action
}
ACTION=$1
SKIP=0
MODULES=$@
if [ "$#" -eq "0" ]; then
echo "No parameters. Only basic packages will be installed"
elif [ "$1" = "-h" ]; then
_help
elif [ "$1" = "-v" ]; then
verbose=1
touch /tmp/dotfiles_verbose
ACTION=$2
SKIP=1
elif [ "$#" -eq "1" ]; then
echo "Missing parameters"
_help
fi
if [ "$#" != "0" ] && [ "$ACTION" != "install" ] && [ "$ACTION" != "uninstall" ]; then
echo "Unknown action: $ACTION"
exit 1
fi
title
sleep 5
. $PWD/__setup/util.sh
if [ ! -f $CMD_FILE ]; then
OS_NAME=`cat /etc/issue 2>/dev/null`
echo "arch" > $CMD_FILE
echo $OS_NAME | tr '[:upper:]' '[:lower:]' | grep ubuntu
[[ "$?" -eq 0 ]] && echo "ubuntu" > $CMD_FILE
fi
run base install
echo $PWD > "$LOC_FILE"
printOK
# get the modules to make actions
idx=0
for mod in "$@"
do
if [ "$idx" -gt "$SKIP" ]; then
run $mod $ACTION
#source $PWD/$mod/module.sh
#$ACTION
fi
idx+=1
done
if [ -f /tmp/dotfiles_verbose ]; then
rm /tmp/dotfiles_verbose
fi