-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·94 lines (84 loc) · 2.39 KB
/
install.sh
File metadata and controls
executable file
·94 lines (84 loc) · 2.39 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
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
#!/usr/bin/env bash
set -e
PLAYBOOK="playbooks/install_tools.yml"
# Function to install Ansible on Debian/Ubuntu
install_ansible_debian() {
sudo apt update
sudo apt install -y software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install -y ansible
}
# Function to install Ansible on Arch Linux
install_ansible_arch() {
sudo pacman -Syu --noconfirm
sudo pacman -S --noconfirm ansible
}
# Function to install Ansible on Fedora
install_ansible_fedora() {
sudo dnf install -y ansible
}
# Function to install Ansible on macOS
install_ansible_macos() {
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)"
fi
brew install ansible
}
# Function to install Ansible on Termux
install_ansible_termux() {
pkg update
pkg install -y python
pip install --upgrade pip
pip install ansible
}
# Detect the platform and install Ansible
install_ansible() {
OS="$(uname -s)"
case "${OS}" in
Linux*)
if [ -f /etc/os-release ]; then
. /etc/os-release
case "${ID}" in
debian|ubuntu)
install_ansible_debian
;;
arch|endeavouros)
install_ansible_arch
;;
fedora)
install_ansible_fedora
;;
*)
echo "Unsupported Linux distribution: ${ID}"
exit 1
;;
esac
elif [ -d /data/data/com.termux ]; then
install_ansible_termux
else
echo "Cannot determine Linux distribution."
exit 1
fi
;;
Darwin*)
install_ansible_macos
;;
*)
echo "Unsupported operating system: ${OS}"
exit 1
;;
esac
}
# Run the Ansible playbook
run_playbook() {
if [ ! -f "${PLAYBOOK}" ]; then
echo "Playbook ${PLAYBOOK} not found in the current directory."
exit 1
fi
ansible-playbook "${PLAYBOOK}"
}
# Main execution
install_ansible
run_playbook
stow {git,zsh,bash,terminals,tmux,cursors,ssh}