-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·115 lines (100 loc) · 2.83 KB
/
Copy pathsetup
File metadata and controls
executable file
·115 lines (100 loc) · 2.83 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env bash
# Arch dotfiles setup script
#
# Uses dotbot for dotfile install but this probably will be made into a custom dotfile manager soon
# Also can install needed packages
full=false
system=false
packages=false
dotfiles=false
extraScripts=false
mode="d"
help() {
printf "Usage: $0 [OPTIONS] [script names]\n"
printf "Argurments:\n"
printf " [script names]\n\tAn optional list of install scripts to run found in ./installScripts/."
printf "\n\tTo run these scripts, pass in the '-e' option.\n\n"
printf "Options:\n"
printf " -h\n\tShow this help message and exit\n"
printf " -f\n\tSetup the complete system. Equivalent to running $0 -s -p -d\n"
printf " -s\n\tConfigure system.\n"
printf " -p\n\tInstall system packages\n"
printf " -d\n\tInstall dotfiles\n"
printf " -e\n\tRun extra install scripts\n"
printf " -m MODE\n\tRun script in a specific mode. Possible modes are:\n\t'd': Desktop (default)\n\t'w': WSL\n\t'c': Dev Container\n"
}
setupSystem() {
if [[ $mode == "d" ]]; then
/usr/bin/env bash ./installScripts/desktop/system
sudo cp ./systemFiles/* / -r
elif [[ $mode == "w" ]]; then
/usr/bin/env bash ./installScripts/wsl/system
fi
}
setupPackages() {
if [[ $mode == "d" ]]; then
/usr/bin/env bash ./installScripts/desktop/packages
elif [[ $mode == "w" ]]; then
/usr/bin/env bash ./installScripts/wsl/packages
fi
}
setupDotfiles() {
if [[ $mode == "d" ]]; then
dotbot -c ./installScripts/desktop/dotbot.conf.yaml
elif [[ $mode == "w" ]]; then
/usr/bin/env bash ./installScripts/wsl/setup
elif [[ $mode == "c" ]]; then
/usr/bin/env bash ./installScripts/container/setup
fi
}
doFullInstall() {
setupPackages
setupSystem
setupDotfiles
}
while getopts 'hfspdem:' opt; do
case "$opt" in
h) help; exit 0;;
f) full=true;;
s) system=true;;
p) packages=true;;
d) dotfiles=true;;
e) extraScripts=true;;
m) mode=${OPTARG};;
*) help; exit 1;;
esac
done
[[ -z "${FULL}" ]] && full=$full || full="${FULL}"
[[ -z "${SYSTEM}" ]] && system=$system || system="${SYSTEM}"
[[ -z "${PACKAGES}" ]] && packages=$packages || packages="${PACKAGES}"
[[ -z "${DOTFILES}" ]] && dotfiles=$dotfiles || dotfiles="${DOTFILES}"
[[ -z "${MODE}" ]] && mode=$mode || mode="${MODE}"
if [[ $mode == "c" ]]; then
full=true
fi
echo "Setting up system with following parameters (if Mode is 'c', Full is automatically true):"
echo " Full: $full"
echo " System: $system"
echo " Packages: $packages"
echo " Dotfiles: $dotfiles"
echo " Mode: $mode"
if [[ $full == true ]]; then
doFullInstall
else
if [[ $packages == true ]]; then
setupPackages
fi
if [[ $system == true ]]; then
setupSystem
fi
if [[ $dotfiles == true ]]; then
setupDotfiles
fi
fi
shift $(( OPTIND - 1 ))
if $extraScripts; then
echo "Running extra scripts..."
for scriptName in "$@"; do
/usr/bin/env bash ./installScripts/$scriptName
done
fi