-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·57 lines (49 loc) · 1.44 KB
/
setup
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
#!/bin/bash
set -u
# Define the base directory where the setup directories are located
SETUP_DIR="./setups"
# Function to list all available software setups
list_tools() {
echo "Available software setups:"
for tool in "${TOOLS[@]}"; do
echo "- $tool"
done
}
# Function to setup a specific tool
setup_tool() {
local tool_name="$1"
echo "Setting up $tool_name..."
local tool_setup_dir="$SETUP_DIR/$tool_name"
local tool_setup_script="$tool_setup_dir/setup.sh"
# Check if the tool-specific setup script exists and is executable
if [[ -x "$tool_setup_script" ]]; then
# Execute the tool-specific setup script
(cd "$tool_setup_dir" && "./setup.sh")
echo "$tool_name setup complete."
else
echo "No setup script found for $tool_name, skipping..."
fi
}
# List of supported tools (directories within setups/)
TOOLS=($(ls -1 $SETUP_DIR))
# Parse command line arguments
if [ "$#" -eq 0 ]; then
echo "Usage: ./setup [TARGET|-a|-l]"
exit 1
elif [ "$1" == "-l" ]; then
list_tools
exit 0
elif [ "$1" == "-a" ]; then
# Install and setup all tools
for tool in "${TOOLS[@]}"; do
setup_tool "$tool"
done
else
TOOL_TO_SETUP=$1
if [[ " ${TOOLS[@]} " =~ " ${TOOL_TO_SETUP} " ]]; then
setup_tool "$TOOL_TO_SETUP"
else
echo "Unsupported or unknown tool: $TOOL_TO_SETUP. Use '-l' to list all available software setups."
exit 1
fi
fi