diff --git a/install b/install index b738198..852aff0 100755 --- a/install +++ b/install @@ -2,8 +2,11 @@ set -euo pipefail cd -- "$(dirname -- "$0")" . mod.bash -(($(id -u) == 0)) \ - && [[ -f /etc/debian_version ]] \ - && install_apt_packages +if (($(id -u) == 0)); then + [[ -f /etc/debian_version ]] \ + && install_apt_packages + [[ $(uname -sm) =~ ^(Linux x86_64|Darwin .*)$ ]] \ + && install_homebrew_packages +fi install_dotfiles install_addons "$@" diff --git a/mod.bash b/mod.bash index e73f99d..76c454b 100644 --- a/mod.bash +++ b/mod.bash @@ -24,6 +24,17 @@ function install_apt_packages() { && rsync -rv etc/default/ /etc/default/ apt update apt install -y "${packages[@]}" + rsync -rv etc/apt/sources.list.d/ "$apt_sources_dir" +} + +function install_homebrew_packages() { + local uid + uid=${SUDO_UID:-$(id -u)} + sudo --user="#$uid" \ + NONINTERACTIVE=1 \ + bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" + sudo --user="#$uid" \ + /home/linuxbrew/.linuxbrew/bin/brew bundle --file=.Brewfile } function install_addons() {