dotfiles/manage.sh

73 lines
1.6 KiB
Bash
Raw Normal View History

2021-08-21 00:11:16 +02:00
#!/usr/bin/env bash
set -eo pipefail
arg=$1
if [[ $arg == "packages-bundle" ]]
then
# Actualizar repositorios
sudo pacman -Sy
# Instalar yay
if ! command -v yay &> /dev/null
then
sudo pacman -S --needed git base-devel
dotfiles_path=$(pwd)
mkdir -p $HOME/Instalados
cd $HOME/Instalados
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd $dotfiles_path
fi
# Instalar aconfmgr
if ! command -v aconfmgr &> /dev/null
then
yay -S aconfmgr-git
fi
# Instalar homebrew
if [[ -f brew ]]
then
yay -S brew-git
sudo chown -R $(whoami).users /opt/brew/
fi
# Instalar paquetes del sistema
aconfmgr -c packages/arch apply
# Instalar paquetes de brew
brew bundle --file packages/brew/Brewfile
# Instalar oh-my-zsh
if [[ -a $HOME/.oh-my-zsh ]]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
elif [[ $arg == "packages-update" ]]
then
# Actualiza oh my zsh
sh "$HOME/.oh-my-zsh/tools/upgrade.sh"
rm -rf "$HOME/.oh-my-zsh/log/update.lock"
# Actualiza arch
sudo pacman -Syu
# Sincroniza los repositorios de brew
brew update
# Actualiza los paquetes instalados
brew upgrade
elif [[ $arg == "dotfiles" ]]
then
cd dotfiles
stow -t ~ alacritty
stow -t ~ git
stow -t ~ i3
stow -t ~ shells
stow -t ~ starship
sudo stow -t / system-configurations
cd ..
else
echo "use 'packages-bundle', 'packages-update' or 'dotfiles'"
fi