Update 'install.sh'

This commit is contained in:
2023-05-01 03:02:12 +02:00
parent 11b68c792c
commit a9f317821f

View File

@@ -6,21 +6,11 @@ function show_help {
while getopts "h?vyi:d" opt; do while getopts "h?vyi:d" opt; do
case "$opt" in case "$opt" in
h|\?) h|\?) show_help; exit 0 ;;
show_help v) P_Verbose=1 ;;
exit 0 d) P_Debug=1 ;;
;; y) P_Yes=1 ;;
v) i) P_Install=$OPTARG
P_Verbose=1
;;
d)
P_Debug=1
;;
y)
P_Yes=1
;;
i)
P_Install=$OPTARG
esac esac
done done
@@ -110,7 +100,7 @@ function install_rc {
fi fi
# Add the file to the rc file as source $file # Add the file to the rc file as source $file
SOURCE_CMD="source $FILE" SOURCE_CMD=$( echo "source $FILE" )
RC="$HOME_PATH/$RC_FILE" RC="$HOME_PATH/$RC_FILE"
if ! cat "$RC" | grep "$SOURCE_CMD" > /dev/null; then if ! cat "$RC" | grep "$SOURCE_CMD" > /dev/null; then
echo "$SOURCE_CMD" >> "$RC" echo "$SOURCE_CMD" >> "$RC"
@@ -118,6 +108,36 @@ function install_rc {
else else
log_info "\"$SOURCE_CMD\" already in $RC" log_info "\"$SOURCE_CMD\" already in $RC"
fi 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 { function install_deb_check {
@@ -245,29 +265,40 @@ function set_shell {
# -------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------
init init
# ----------------- # -----------------
# zsh # zsh
# ----------------- # -----------------
apt_install zsh apt_install zsh
## Set Shell to zsh
set_shell 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 # tmux
# ----------------- # -----------------
apt_install 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.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 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 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" git_clone "https://github.com/tmux-plugins/tpm" "$HOME/.tmux/plugins/tpm"
# -----------------
# unp
# ----------------- # -----------------
apt_install unp apt_install unp
# --- TODO --- : rc file
# ----------------- # -----------------
# bat # bat
@@ -275,9 +306,9 @@ apt_install unp
install_deb_github bat "sharkdp/bat" "bat_VERSION_ARCH.deb" 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_rc bat https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.bat.rc
# Install glances # -----------------
# Install lsd https://github.com/Peltoche/lsd # Install lsd https://github.com/Peltoche/lsd
# -----------------
install_deb_github "lsd" "lsd-rs/lsd" "lsd_VERSION_ARCH.deb" 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 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" 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 #wget -O .zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
# -----------------
# Install OhMyPosh # Install OhMyPosh
# -----------------
download_config "omp" "omp.json" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.omp.json" 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_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" 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" #git clone https://github.com/zsh-users/zsh-autosuggestions "$HOME/.config/zsh/zsh-autosuggestions"
# source ~/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh # source ~/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh