1
0
Fork 0
mirror of https://github.com/kou029w/dotfiles.git synced 2025-01-18 16:07:59 +00:00

add install_homebrew_packages function

This commit is contained in:
Nebel 2022-06-15 19:54:15 +09:00
parent c8b8dfa4c9
commit e9892167cf
2 changed files with 17 additions and 3 deletions

View file

@ -2,8 +2,11 @@
set -euo pipefail
cd -- "$(dirname -- "$0")"
. mod.bash
(($(id -u) == 0)) \
&& [[ -f /etc/debian_version ]] \
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 "$@"

View file

@ -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() {