#!/bin/sh help() { printf 'Choose one or more options from the following list\nto add as an argument to the script:\n' grep -P '^\s+[a-z\-]+\)' "$0" | sed 's/)//' | xargs printf ' - %s\n' exit 0 } link() { [ -e "$2" ] && printf 'found existing file %s\n' "$2" && rm -i "$2" ln -s "$1" "$2" 2>/dev/null } [ $# -eq 0 ] && help command -v git >/dev/null || (echo "Install git to run this script" && exit 1) command -v curl >/dev/null || (echo "Install curl to run this script" && exit 1) for option in "$@"; do case $option in alacritty) [ ! -d "$HOME/.config/alacritty" ] && mkdir -p "$HOME/.config/alacritty" link "$PWD/alacritty/alacritty.toml" "$HOME/.config/alacritty/alacritty.toml" ;; alacritty-desktop) [ ! -d "$HOME/.config/alacritty" ] && mkdir -p "$HOME/.config/alacritty" link "$PWD/alacritty/desktop.toml" "$HOME/.config/alacritty/desktop.toml" ;; zsh) mkdir -p "$HOME/.config/zsh" mkdir -p "/etc/zsh" echo "export ZDOTDIR=\"\$HOME\"/.config/zsh" | sudo tee /etc/zsh/zshenv ZSH="$HOME/.config/zsh/ohmyzsh" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended mkdir -p ~/.config/zsh/ohmyzsh/custom/plugins git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.config/zsh/ohmyzsh/custom/plugins/zsh-syntax-highlighting git clone https://github.com/zsh-users/zsh-autosuggestions ~/.config/zsh/ohmyzsh/custom/plugins/zsh-autosuggestions link "$PWD/zsh/zshrc" "$HOME/.config/zsh/.zshrc" ;; git) [ ! -d "$HOME/.config/git" ] && mkdir -p "$HOME/.config/git" link "$PWD/git/config" "$HOME/.config/git/config" command -v gh>/dev/null && gh auth login ;; user-dirs) link "$PWD/user-dirs/user-dirs.dirs" "$HOME/.config/user-dirs.dirs" xdg-user-dirs-update ;; packages) command -v yay >/dev/null || (echo "Install yay to install packages" && exit 1) cat packages/pkgs | yay -S - ;; librewolf) printf 'Paste the path of the Root Directory of your default profile\n' librewolf about:profiles > /dev/null 2> /dev/null read -r profile link "$PWD/librewolf/user.js" "$profile/user.js" ;; scripts) [ ! -d "$HOME/.local/bin" ] && mkdir -p "$HOME/.local/bin" cp scripts/* "$HOME/.local/bin" ;; vim) mkdir -p ~/.config/vim git clone https://github.com/VundleVim/Vundle.vim.git ~/.config/vim/bundle/Vundle.vim link "$PWD/vim/vimrc" "$HOME/.config/vim/vimrc" vim +PluginInstall +qall ;; yay) link "$PWD/yay/config.json" "$HOME/.config/yay/config.json" ;; help) help ;; *) printf '\033[0;31mno config file found for "%s"\033[0m\n' "$option" help exit 1 ;; esac printf '\033[0;32mDeployed configs for %s\033[0m\n' "$option" done