-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·56 lines (45 loc) · 1.12 KB
/
setup.sh
File metadata and controls
executable file
·56 lines (45 loc) · 1.12 KB
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
#!/bin/bash
# This is safe to run multiple times and will prompt you about anything unclear
# Check config.sh file to configure dotfiles, plugins and packages
source ./config.sh
source ./lib/echos.sh
source ./lib/utils.sh
source ./lib/dotfiles.sh
source ./lib/os.sh
source ./lib/zsh.sh
# Parameters
# -u to define a user
# -f to force and do not ask for confirmation at the beginning
while getopts ":u:f" opt; do
case $opt in
u) USER_PARAM="$OPTARG"
;;
f) FORCE=1
;; \?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
# Get current dir (so run this script from anywhere)
DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOTFILES_USER="default"
start
if ! is_osx; then
error "Operating System not supported"
exit;
fi
install_os_packages
setup_os_packages
install_dotfiles
install_zsh
unset DOTFILES_USER
DOTFILES_USER=$USER_PARAM
if [[ $DOTFILES_USER ]]; then
if [[ ! -f "$DOTFILES_DIR/config_$DOTFILES_USER.sh" ]]; then
error "Config file not found: config_${DOTFILES_USER}.sh"
exit 1
fi
source "$DOTFILES_DIR/config_$DOTFILES_USER.sh"
install_os_packages
fi
cleanup
end