-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·65 lines (52 loc) · 1.51 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·65 lines (52 loc) · 1.51 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
#!/bin/sh
# Enable strict error handling
set -eu
# Run shellcheck on the current script if available
if command -v shellcheck >/dev/null 2>&1; then
shellcheck "$0" || echo "Shellcheck found issues."
else
echo "Shellcheck not found, skipping..."
fi
# Function to print an error message
error() {
printf "\033[31mError: %s\033[0m\n" "$1" >&2
}
# Determine the directory of the script
SCRIPT_DIR=$(dirname "$(realpath "$0")")
# Determine the repository root relative to the script directory
REPO_ROOT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)
# Source the helper script
# shellcheck disable=SC1091
. "$REPO_ROOT/helpers.sh"
# Function to prompt the user for input
prompt_user() {
while true; do
echo "$1 (y/n): "
read -r response
case "$response" in
[Yy]*) return 0 ;;
[Nn]*) return 1 ;;
*) echo "Please answer yes or no." ;;
esac
done
}
# Ensure prerequisites are met
ensure_prerequisites git
# Prompt the user for each module
if prompt_user "\nRun git_config/install.sh"; then
echo "Running git_config/install.sh..."
"$REPO_ROOT/git_config/install.sh"
fi
if prompt_user "\nRun shell/install.sh"; then
echo "Running shell/install.sh..."
"$REPO_ROOT/shell/install.sh"
fi
if prompt_user "\nRun vscodium/install.sh"; then
echo "Running vscodium/install.sh..."
"$REPO_ROOT/vscodium/install.sh"
fi
if prompt_user "\nRun nix/install.sh"; then
echo "Running nix/install.sh..."
"$REPO_ROOT/nix/install.sh"
fi
echo "Setup complete."