Take a first pass at cleaning up install

This commit is contained in:
Andrew Tomaka 2023-10-25 19:42:26 -04:00
parent 38a06a550b
commit 96d9d33169
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
5 changed files with 202 additions and 43 deletions

View file

@ -1,7 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
install_homebrew() { install_homebrew() {
if ! command -v brew > /dev/null; then echo -n Checking homebrew...
if command -v brew > /dev/null; then
echo -n already installed...
else
echo -n installing...
NONINTERACTIVE=1 /bin/bash -c "$( NONINTERACTIVE=1 /bin/bash -c "$(
curl \ curl \
--fail \ --fail \
@ -11,21 +15,31 @@ install_homebrew() {
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
)" )"
fi fi
echo done
} }
install_shared_applications() { install_shared_brew_packages() {
brew install direnv fzf git stow the_silver_searcher tmux \ echo -n Checking shared brew packages...
vim zsh chruby ruby-build tfenv nodenv node-build tig libpq gnupg llvm \ missing_packages=$(
awscli cmake jq watch gh nvim openssl@1.1 openssl@3 readline libyaml gmp \ comm -23 <(cat packages-shared-brew.txt) <(brew list | sort) \
pyenv ripgrep | tr "\n" " "
)
install_fzf if [[ -z $missing_packages ]]; then
install_rust echo -n already installed...
install_vim else
echo -n installing $missing_packages...
brew install $missing_packages
fi
echo done
} }
install_alacritty() { install_alacritty() {
if ! command -v alacritty > /dev/null; then echo -n Checking Alacritty...
if command -v alacritty > /dev/null; then
echo -n already installed...
else
echo -n installing...
cargo install alacritty cargo install alacritty
curl \ curl \
@ -45,10 +59,15 @@ install_alacritty() {
sudo update-desktop-database sudo update-desktop-database
sudo ln -s /home/$USER/.cargo/bin/alacritty /usr/local/bin/alacritty sudo ln -s /home/$USER/.cargo/bin/alacritty /usr/local/bin/alacritty
fi fi
echo done
} }
install_alacritty_terminfo() { install_alacritty_terminfo() {
if ! infocmp alacritty > /dev/null; then echo -n Checking Alacritty terminfo...
if infocmp alacritty > /dev/null; then
echo -n already installed...
else
echo -n installing...
curl \ curl \
--fail \ --fail \
--location \ --location \
@ -57,10 +76,15 @@ install_alacritty_terminfo() {
sudo tic -xe alacritty,alacritty-direct /tmp/alacritty.info sudo tic -xe alacritty,alacritty-direct /tmp/alacritty.info
fi fi
echo done
} }
install_tmux_terminfo() { install_tmux_terminfo() {
if ! infocmp tmux-256color > /dev/null; then echo -n Checking Tmux terminfo...
if infocmp tmux-256color > /dev/null; then
echo -n already installed...
else
echo -n installling....
curl \ curl \
--fail \ --fail \
--location \ --location \
@ -74,18 +98,30 @@ install_tmux_terminfo() {
sudo tic -xe tmux-256color tmux-256color.src sudo tic -xe tmux-256color tmux-256color.src
popd popd
fi fi
echo done
} }
install_fzf() { install_fzf() {
echo -n Checking fzf...
if [[ $PATH =~ "fzf" ]]; then
echo -n already installed...
else
echo -n installing...
$(brew --prefix)/opt/fzf/install \ $(brew --prefix)/opt/fzf/install \
--xdg \ --xdg \
--no-update-rc \ --no-update-rc \
--key-bindings \ --key-bindings \
--completion --completion
fi
echo done
} }
install_rust() { install_rust() {
if ! command -v rustup > /dev/null; then echo -n Checking Rust...
if command -v rustup > /dev/null; then
echo -n already installed...
else
echo -n installing...
curl \ curl \
--fail \ --fail \
--proto '=https' \ --proto '=https' \
@ -95,13 +131,83 @@ install_rust() {
https://sh.rustup.rs \ https://sh.rustup.rs \
| sh -s -- -y --no-modify-path | sh -s -- -y --no-modify-path
fi fi
echo done
} }
install_vim() { install_linux_packagges() {
if ! test -d ~/.local/share/nvim/site > /dev/null; then echo -n Checking Linux packages...
git clone --depth 1 https://github.com/wbthomason/packer.nvim \ packages=$(cat packages-linux-apt.txt | tr "\n" " ")
~/.local/share/nvim/site/pack/packer/start/packer.nvim if dpkg -s $packages >/dev/null 2>&1; then
echo -n already installed...
else
echo -n installing...
sudo apt-get install --assume-yes $packages
fi fi
echo done
}
install_darwin_brew_packages() {
echo -n Checking Darwin brew packages...
missing_packages=$(
comm -23 <(cat packages-darwin-brew.txt) <(brew list | sort) \
| tr "\n" " "
)
if [[ -z $missing_packages ]]; then
echo -n already installed...
else
echo -n installing $missing_packages...
brew install --cask $missing_packages
fi
echo done
}
install_darwin_brew_cask_packages() {
echo -n Checking Darwin brew cask packages...
missing_packages=$(
comm -23 <(cat packages-darwin-brew-cask.txt) <(brew list | sort) \
| tr "\n" " "
)
if [[ -z $missing_packages ]]; then
echo -n already installed...
else
echo -n installing $missing_packages...
brew install --cask $missing_packages
fi
echo done
}
install_color_default() {
echo -n Checking color default file...
if [[ -f $HOME/.config/atomaka/color.yml ]]; then
echo -n already installed...
else
echo -n installing....
$HOME/dotfiles/bin/bin/toggle-color-mode
fi
echo done
}
install_darwin_profile_hack() {
echo -n Checking profile hack...
if [[ ! -f /etc/zprofile ]]; then
echo -n already installled...
else
echo -n installing...
sudo mv /etc/{zprofile,zprofile.old}
fi
}
install_env() {
echo -n Checking zshenv available...
if [[ -z $HOMEBREW_PREFIX ]]; then
echo -n already installed...
else
echo -n installling...
source ~/dotfiles/zsh/.zshenv
fi
echo done
} }
install_linux() { install_linux() {
@ -110,34 +216,26 @@ install_linux() {
exit 1 exit 1
fi fi
packages="build-essential procps curl file git cmake pkg-config\ install_linux_packagges
libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev\
libxkbcommon-dev python3 libssl-dev xclip"
dpkg -s $packages >/dev/null 2>&1 \
|| sudo apt-get install --assume-yes $packages
install_homebrew install_homebrew
source ~/dotfiles/zsh/.zshenv install_env
install_shared_applications install_shared_brew_packages
install_fzf
# gui install_rust
install_alacritty install_alacritty
install_alacritty_terminfo install_alacritty_terminfo
} }
install_darwin() { install_darwin() {
install_darwin_profile_hack
install_homebrew install_homebrew
[[ -f /etc/zprofile ]] && sudo mv /etc/{zprofile,zprofile.old} install_env
source ~/dotfiles/zsh/.zshenv install_shared_brew_packages
install_shared_applications install_fzf
install_rust
softwareupdate --install-rosetta --agree-to-license softwareupdate --install-rosetta --agree-to-license
brew install coreutils gnu-sed session-manager-plugin orbstack install_darwin_brew_packages
install_darwin_brew_cask_packages
# gui
brew install --cask rectangle slack google-chrome alacritty telegram \
discord element brave-browser zoom notion
install_tmux_terminfo install_tmux_terminfo
} }
@ -155,7 +253,7 @@ main() {
stow alacritty bin git nvim ruby tmux zsh stow alacritty bin git nvim ruby tmux zsh
$HOME/dotfiles/bin/bin/toggle-color-mode install_color_default
} }
main main

View file

@ -0,0 +1,11 @@
alacritty
brave-browser
discord
element
firefox
google-chrome
notion
rectangle
slack
telegram
zoom

4
packages-darwin-brew.txt Normal file
View file

@ -0,0 +1,4 @@
coreutils
gnu-sed
orbstack
session-manager-plugin

14
packages-linux-apt.txt Normal file
View file

@ -0,0 +1,14 @@
build-essential
cmake
curl
file
git
libfontconfig1-dev
libfreetype6-dev
libssl-dev
libxcb-xfixes0-dev
libxkbcommon-dev
pkg-config
procps
python3
xclip

32
packages-shared-brew.txt Normal file
View file

@ -0,0 +1,32 @@
awscli
bzip2
chruby
cmake
direnv
fontconfig
fzf
gh
git
gmp
gnupg
jq
libpq
libyaml
llvm
neovim
node-build
nodenv
openssl@1.1
openssl@3
pyenv
readline
ripgrep
ruby-build
stow
tfenv
the_silver_searcher
tig
tmux
vim
watch
zsh