-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_after_updater.sh
executable file
·48 lines (39 loc) · 1.33 KB
/
run_after_updater.sh
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
#!/bin/bash
CHEZMOI_SOURCE=$(chezmoi source-path)
source "$CHEZMOI_SOURCE/updaters/helpers/utils.sh"
prompt_to_continue "Run updater?"
# Directory holding the scripts
SCRIPT_DIR="$CHEZMOI_SOURCE/updaters"
# # Get a list of all bash scripts in the directory
# scripts=($(ls $SCRIPT_DIR/*.sh))
# # Function to display scripts and get user input
# select_scripts_to_skip() {
# echo "Select the scripts you want to skip (e.g., 1 3 5):"
# for ((i=0; i<${#scripts[@]}; i++)); do
# echo "$((i+1)). $(basename ${scripts[$i]})"
# done
# read -a skipped_indices
# }
# echo ""
# # Get user input
# select_scripts_to_skip
# # Execute the scripts that weren't skipped with sudo
# for ((i=0; i<${#scripts[@]}; i++)); do
# # check if current script index is in the list of skipped indices
# if ! [[ " ${skipped_indices[@]} " =~ " $((i+1)) " ]]; then
# echo ""
# echo "Running $(basename ${scripts[$i]})..."
# bash "${scripts[$i]}"
# echo ""
# else
# echo "Skipping $(basename ${scripts[$i]})"
# fi
# done
# Loop over all .sh files in the specified directory and execute them
for script in "$SCRIPT_DIR"/*.sh; do
if [[ -f "$script" ]]; then
echo "> $(basename ${script})"
bash "$script" # or sh "$script", depending on your preference
echo ""
fi
done