]> git.r.bdr.sh - rbdr/dotfiles/blame - provision
Merge branch 'main' of git.sr.ht:~rbdr/dotfiles
[rbdr/dotfiles] / provision
CommitLineData
cb36b00f 1#!/usr/bin/env bash
8bf2adee
RBR
2
3if [[ -z "$1" ]]; then
4 echo "Run with parameters: essential, nice, cask_essential, or cask_nice"
5else
6 if command -v brew &> /dev/null; then
7 command_name="brew"
ad7a214d 8 install_command="install"
8bf2adee
RBR
9 else
10 if command -v apt &> /dev/null; then
650123f4 11 command_name="apt"
ad7a214d 12 install_command="install"
8bf2adee 13 else
ad7a214d
RBR
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
8bf2adee
RBR
21 fi
22 fi
23 file="./provisioning/${command_name}_$1"
24 if [[ -f $file ]]; then
25 echo "Provisioning $1 with $command_name"
ad7a214d 26 cat ./provisioning/${command_name}_$1 | xargs ${command_name} ${install_command}
8bf2adee
RBR
27 else
28 echo "No provisioning recipe for $1 with $command_name"
1c7e8bca 29 exit 1
8bf2adee
RBR
30 fi
31fi