From ce2d77965386133a81c7c2ab42e542da01e615f7 Mon Sep 17 00:00:00 2001 From: Johannes Knopp Date: Thu, 19 Dec 2024 12:58:11 +0100 Subject: [PATCH] add install script --- install.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..1912695 --- /dev/null +++ b/install.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +create_symlink() { + local source=$1 + local target=$2 + + if [ -ne "$target" ]; then + ln -s "$source" "$target" + fi +} + +install_package() { + local package=$1 + if ! command_exists "$package"; then + sudo dnf update && sudo dnf install "$package" + fi +} + +install_package "neovim" +create_symlink "$HOME/dotfiles/nvim" "$HOME/.config/nvim" + +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 https://github.com/zsh-users/zsh-syntax-highlighting.git \ + ${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting +fi