-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkasm_dependencies.sh
95 lines (84 loc) · 2.39 KB
/
kasm_dependencies.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
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
#!/bin/bash
# Check for and install Homebrew (macOS only)
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v brew &>/dev/null; then
echo "Homebrew not found. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ $? -ne 0 ]; then
echo "Error: Homebrew installation failed."
exit 1
fi
else
echo "Homebrew is already installed."
fi
else
echo "Skipping Homebrew installation (not macOS)."
fi
# Function to install Ansible
install_ansible() {
if command -v apt-get &>/dev/null; then
sudo apt-get update -y
sudo apt-get install -y ansible
elif command -v yum &>/dev/null; then
sudo yum install -y epel-release
sudo yum install -y ansible
elif command -v snap &>/dev/null; then
sudo snap install ansible --classic
elif command -v brew &>/dev/null; then
brew install ansible
else
echo "Unsupported package manager. Please install Ansible manually."
exit 1
fi
}
# Function to install jq
install_jq() {
if command -v apt-get &>/dev/null; then
sudo apt-get update -y
sudo apt-get install -y jq
elif command -v yum &>/dev/null; then
sudo yum install -y epel-release
sudo yum install -y jq
elif command -v snap &>/dev/null; then
sudo snap install jq
elif command -v brew &>/dev/null; then
brew install jq
else
echo "Unsupported package manager. Please install jq manually."
exit 1
fi
}
sleep 0.2
# Install Ansible
if ! command -v ansible &>/dev/null; then
echo "Ansible not found. Installing Ansible..."
install_ansible
if [ $? -ne 0 ]; then
echo "Error: Ansible installation failed."
exit 1
fi
else
echo "Ansible is already installed."
fi
# Install jq
if ! command -v jq &>/dev/null; then
echo "jq not found. Installing jq..."
install_jq
if [ $? -ne 0 ]; then
echo "Error: jq installation failed."
exit 1
fi
else
echo "jq is already installed."
fi
sleep 0.2
# Check for the Kasm release tar.gz file
if [ ! -f roles/install_common/files/*.tar.gz ]; then
echo "Warning: No Kasm release .tar.gz file found in roles/install_common/files/."
else
echo "Kasm release .tar.gz file found in roles/install_common/files/."
echo "Please ensure this is the correct file for your installation."
fi
sleep 0.2
# Additional dependencies can be added here as needed
echo "All dependencies have been installed successfully."