]> git.r.bdr.sh - rbdr/dotfiles/blob - provision
Update
[rbdr/dotfiles] / provision
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 apt &> /dev/null; then
11 command_name="apt"
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 echo "Error: No valid package manager. Make sure brew or apt are available."
19 exit 1
20 fi
21 fi
22 fi
23 file="./provisioning/${command_name}_$1"
24 if [[ -f $file ]]; then
25 echo "Provisioning $1 with $command_name"
26 cat ./provisioning/${command_name}_$1 | xargs ${command_name} ${install_command}
27 else
28 echo "No provisioning recipe for $1 with $command_name"
29 exit 1
30 fi
31 fi