]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env bash | |
2 | ||
3 | if [[ -z "$1" ]]; then | |
4 | echo "Run with parameters: essential, nice, cask_essential, or cask_nice" | |
5 | else | |
6 | if command -v brew &> /dev/null; then | |
7 | command_name="brew" | |
8 | install_command="install" | |
9 | else | |
10 | if command -v dnf &> /dev/null; then | |
11 | command_name="dnf" | |
12 | install_command="install" | |
13 | else | |
14 | if command -v pacman &> /dev/null; then | |
15 | command_name="pacman" | |
16 | install_command="-Sy" | |
17 | else | |
18 | if command -v pacman &> /dev/null; then | |
19 | command_name="apt" | |
20 | install_command="install" | |
21 | else | |
22 | echo "Error: No valid package manager. Make sure brew or apt are available." | |
23 | exit 1 | |
24 | fi | |
25 | fi | |
26 | fi | |
27 | fi | |
28 | file="./provisioning/${command_name}_$1" | |
29 | if [[ -f $file ]]; then | |
30 | echo "Provisioning $1 with $command_name" | |
31 | cat ./provisioning/${command_name}_$1 | xargs ${command_name} ${install_command} | |
32 | else | |
33 | echo "No provisioning recipe for $1 with $command_name" | |
34 | exit 1 | |
35 | fi | |
36 | fi |