implement basic ansible config
This commit is contained in:
70
install.sh
70
install.sh
@ -1,48 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
set -e
|
||||
|
||||
DOTFILES_DIR="$HOME/dotfiles"
|
||||
|
||||
|
||||
function arch_setup() {
|
||||
if ! [ -x "$(which ansible)" ]; then
|
||||
echo "Installing ansible"
|
||||
sudo pacman -S ansible
|
||||
fi
|
||||
}
|
||||
|
||||
create_symlink() {
|
||||
local source=$1
|
||||
local target=$2
|
||||
|
||||
if [ ! -e "$target" ]; then
|
||||
ln -s "$source" "$target"
|
||||
echo "Added symlink $source -> $target"
|
||||
fi
|
||||
|
||||
function detect_os() {
|
||||
source /etc/os-release
|
||||
echo "$ID"
|
||||
}
|
||||
|
||||
install_package() {
|
||||
local package=$1
|
||||
if ! command_exists "$package"; then
|
||||
# sudo dnf update && sudo dnf install "$package"
|
||||
sudo pacman -S "$package"
|
||||
fi
|
||||
}
|
||||
local_os=$(detect_os)
|
||||
|
||||
install_package "neovim"
|
||||
create_symlink "$HOME/dotfiles/nvim" "$HOME/.config/nvim"
|
||||
case $local_os in
|
||||
cachyos|arch)
|
||||
arch_setup
|
||||
;;
|
||||
debian)
|
||||
debian_setup
|
||||
;;
|
||||
fedora)
|
||||
fedora_setup
|
||||
;;
|
||||
*)
|
||||
echo "OS $local_os not supported"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
install_package "zsh"
|
||||
create_symlink "$HOME/dotfiles/zsh/.zshrc" "$HOME/.zshrc"
|
||||
|
||||
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
fi
|
||||
|
||||
ZSH_CUSTOM=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}
|
||||
|
||||
# Install zsh-syntax-highlighting
|
||||
if [ ! -d "${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting" ]; then
|
||||
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git \
|
||||
${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting
|
||||
fi
|
||||
|
||||
|
||||
# Install zsh-syntax-highlighting
|
||||
if [ ! -d "${ZSH_CUSTOM}/plugins/fzf-zsh-plugin" ]; then
|
||||
git clone --depth 1 https://github.com/unixorn/fzf-zsh-plugin.git \
|
||||
${ZSH_CUSTOM}/plugins/fzf-zsh-plugin
|
||||
fi
|
||||
ansible-playbook "$DOTFILES_DIR/playbook.yml" "$@"
|
||||
Reference in New Issue
Block a user