-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·92 lines (68 loc) · 1.99 KB
/
install.sh
File metadata and controls
executable file
·92 lines (68 loc) · 1.99 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
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
#!/usr/bin/env bash
source "$(pwd)/scripts/lib-colors.sh"
source "$(pwd)/scripts/lib-init.sh"
source "$(pwd)/scripts/lib-stow.sh"
delete-file() {
((VERBOSE & 1)) && debug "Deleting file '$1'"
rm -rf $1
}
handle-file-exists() {
subdebug "OVERWRITE: $OVERWRITE"
((OVERWRITE & 1)) && subdebug "Deleting file '$1'" && rm -rf $1 && return
subwarning "File '$(yellow $1)' exists!"
read -p " - Overwrite? [y/n]" answer
if [[ "$answer" =~ ^[Yy]$ ]]; then
subdebug "Deleting file '$1'" && rm -rf $1
else
error "GNU Stow will fail if '$(yellow $1)' already exists. Aborting."
exit 1
fi
}
handle-install-extras() {
info "Installing extras."
stow-recursive "$(pwd)/stow/extras" true
exit 0
}
handle-install-packages() {
info "Installing packages."
}
handle-stow-dotfiles() {
info "Stowing dotfiles."
flags=$(get-stow-flags ~/.zshrc)
((flags & FLG_EXISTS)) && handle-file-exists ~/.zshrc
flags=$(get-stow-flags ~/.zprofile)
((flags & FLG_EXISTS)) && handle-file-exists ~/.zprofile
stow-recursive "$(pwd)/stow/core"
case "$OS_PLATFORM" in
"darwin")
stow-recursive "$(pwd)/stow/macos"
;;
"linux")
stow-recursive "$(pwd)/stow/linux"
read -p " - Deploy package omarchy? [y/n]" answer
if [[ "$answer" =~ ^[Yy]$ ]]; then
stow-recursive "$(pwd)/stow/extras/omarchy"
fi
;;
esac
}
handle-show-help() {
show_help
exit 1
}
main() {
if ((INSTALL_XTRAS == 1)); then
handle-install-extras
exit 0
fi
# Do nothing but show help if no options were specified.
! ((INSTALL_PACKAGES || STOW_DOTFILES)) && handle-show-help
# Debugging info.
((VERBOSE & 1)) && show_debug_command
info "Starting install."
((INSTALL_PACKAGES & 1)) && handle-install-packages || info "$(yellow '--install-packages') option was not passed. Skipping package install."
((STOW_DOTFILES & 1)) && handle-stow-dotfiles || info "$(yellow '--stow-dotfiles') option was not passed. Skipping stowing dotfiles."
info "Finished!"
}
# Kick it off!
main