-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·56 lines (47 loc) · 1.43 KB
/
install
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
#!/bin/bash
set -u
# Define the base directory where the setup directories are located
INSTALL_DIR="./installers"
# Function to list all available software setups
list_tools() {
echo "Available installers:"
for installer in "${INSTALLERS[@]}"; do
echo "- $installer"
done
}
# Function to setup a specific tool
install() {
local tool_name="$1"
echo "Setting up $tool_name..."
local tool_setup_script="${INSTALL_DIR}/${tool_name}.sh"
# Check if the tool-specific setup script exists and is executable
if [[ -x "$tool_setup_script" ]]; then
./$tool_setup_script
echo "$tool_name install complete."
else
echo "No setup script found for $tool_name, skipping..."
fi
}
# List of supported tools (script within installers/)
INSTALLERS=($(find $INSTALL_DIR -type f -name "*.sh" | xargs -n1 basename | sed 's/.sh//'))
# Parse command line arguments
if [ "$#" -eq 0 ]; then
echo "Usage: ./install [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 "${INSTALLERS[@]}"; do
install "$tool"
done
else
TOOL_TO_INSTALL=$1
if [[ " ${INSTALLERS[@]} " =~ " ${TOOL_TO_INSTALL} " ]]; then
install "$TOOL_TO_INSTALL"
else
echo "Unsupported or unknown tool: $TOOL_TO_INSTALL. Use '-l' to list all available software installers."
exit 1
fi
fi