diff --git a/install.sh b/install.sh index 2d441f2..c46eb09 100644 --- a/install.sh +++ b/install.sh @@ -6,21 +6,11 @@ function show_help { while getopts "h?vyi:d" opt; do case "$opt" in - h|\?) - show_help - exit 0 - ;; - v) - P_Verbose=1 - ;; - d) - P_Debug=1 - ;; - y) - P_Yes=1 - ;; - i) - P_Install=$OPTARG + h|\?) show_help; exit 0 ;; + v) P_Verbose=1 ;; + d) P_Debug=1 ;; + y) P_Yes=1 ;; + i) P_Install=$OPTARG esac done @@ -110,7 +100,7 @@ function install_rc { fi # Add the file to the rc file as source $file - SOURCE_CMD="source $FILE" + SOURCE_CMD=$( echo "source $FILE" ) RC="$HOME_PATH/$RC_FILE" if ! cat "$RC" | grep "$SOURCE_CMD" > /dev/null; then echo "$SOURCE_CMD" >> "$RC" @@ -118,6 +108,36 @@ function install_rc { else log_info "\"$SOURCE_CMD\" already in $RC" fi + + # Add the file to the rc file as source $file in root + RC_ROOT="/root/$RC_FILE" + if ! sudo cat "$RC_ROOT" | grep "$SOURCE_CMD" > /dev/null; then + echo "$SOURCE_CMD" | sudo tee -a "$RC_ROOT" + log_add "Added \"$SOURCE_CMD\" to $RC_ROOT" + else + log_info "\"$SOURCE_CMD\" already in $RC_ROOT" + fi +} + +function init_install_rc { + # Add the file to the rc file as source $file + SOURCE_CMD="$1" + RC="$HOME_PATH/$RC_FILE" + if ! cat "$RC" | grep "$SOURCE_CMD" > /dev/null; then + echo "$SOURCE_CMD" >> "$RC" + log_add "Added \"$SOURCE_CMD\" to $RC" + else + log_info "\"$SOURCE_CMD\" already in $RC" + fi + + # Add the file to the rc file as source $file in root + RC_ROOT="/root/$RC_FILE" + if ! sudo cat "$RC_ROOT" | grep "$SOURCE_CMD" > /dev/null; then + echo "$SOURCE_CMD" | sudo tee -a "$RC_ROOT" + log_add "Added \"$SOURCE_CMD\" to $RC_ROOT" + else + log_info "\"$SOURCE_CMD\" already in $RC_ROOT" + fi } function install_deb_check { @@ -245,29 +265,40 @@ function set_shell { # -------------------------------------------------------------------------------------------------- - init # ----------------- # zsh # ----------------- apt_install zsh - -## Set Shell to zsh set_shell zsh +# --- TODO --- : Keyboard navigation, Suggestions, ... + + +# ----------------- +# General Config +# ----------------- +init_install_rc "export KHOME=$HOME_PATH" +init_install_rc "export XDG_CONFIG_HOME=$CONFIG_PATH" +install_rc "shell" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.general.rc" + # ----------------- # tmux # ----------------- apt_install tmux -## Install Config and Theme download_config tmux tmux.conf https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.tmux.conf download_config tmux tmux.theme https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.tmux.theme +download_config tmux myip.sh https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/myip.sh +sudo chmod +x ${CONFIG_HOME}/tmux/myip.sh install_rc tmux https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.tmux.rc git_clone "https://github.com/tmux-plugins/tpm" "$HOME/.tmux/plugins/tpm" +# ----------------- +# unp # ----------------- apt_install unp +# --- TODO --- : rc file # ----------------- # bat @@ -275,9 +306,9 @@ apt_install unp install_deb_github bat "sharkdp/bat" "bat_VERSION_ARCH.deb" install_rc bat https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.bat.rc -# Install glances - +# ----------------- # Install lsd https://github.com/Peltoche/lsd +# ----------------- install_deb_github "lsd" "lsd-rs/lsd" "lsd_VERSION_ARCH.deb" install_rc lsd https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.lsd.rc download_config lsd "config.yaml" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.lsd.conf" @@ -285,13 +316,13 @@ download_config lsd "themes/kamu.yaml" "https://git.cbeck.tech/kamu/dotfiles/raw #wget -O .zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc +# ----------------- # Install OhMyPosh +# ----------------- download_config "omp" "omp.json" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.omp.json" install_rc "omp" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.omp.rc" install_binary_github "oh-my-posh" "JanDeDobbeleer/oh-my-posh" "posh-linux-ARCH" -################# -## zsh #git clone https://github.com/zsh-users/zsh-autosuggestions "$HOME/.config/zsh/zsh-autosuggestions" # source ~/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh