1
0
Fork 0
mirror of https://github.com/kou029w/dotfiles.git synced 2025-01-17 23:55:07 +00:00

create homebrew addon

This commit is contained in:
Nebel 2022-08-20 01:21:22 +09:00
parent d1514ba0e1
commit f3b0f9dfe2
4 changed files with 19 additions and 13 deletions

View file

@ -13,5 +13,5 @@ sudo ./install
or
```sh
sudo ./install desktop
sudo ./install homebrew desktop
```

18
homebrew/install Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
cd -- "$(dirname -- "$0")"
function install_homebrew_packages() {
local uid
uid=${SUDO_UID:-$(id -u)}
sudo --user="#$uid" \
mkdir -p /home/linuxbrew/.linuxbrew
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 --global
}
[[ $(uname -sm) =~ ^(Linux x86_64)$ ]] \
&& install_homebrew_packages

View file

@ -5,8 +5,6 @@ cd -- "$(dirname -- "$0")"
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

@ -27,16 +27,6 @@ function install_apt_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() {
local addon
for addon in "$@"; do