From f3ee35f5774255e29ccf2d640f66126ea8b8e089 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Mon, 21 Oct 2024 15:27:07 +0200 Subject: [PATCH] chore: Update to use bash instead of zsh --- .bashrc | 93 ++++++++++++++++++++++ .zshrc | 125 ------------------------------ bin/actions/export.sh | 2 +- bin/actions/hotkey-daemon.sh | 2 +- bin/actions/push.sh | 2 +- bin/actions/secrets.sh | 2 +- bin/actions/startup.sh | 4 +- bin/actions/status.sh | 2 +- bin/actions/term.sh | 2 +- bin/actions/update.sh | 16 ++-- bin/dotf | 2 +- bin/dotf-screenshot | 2 +- bin/helpers/apt_packages.sh | 2 +- bin/helpers/cargo_packages.sh | 2 +- bin/helpers/docker.sh | 2 +- bin/helpers/flatpak_packages.sh | 2 +- bin/helpers/fonts.sh | 2 +- bin/helpers/functions.sh | 2 +- bin/helpers/git.sh | 2 +- bin/helpers/gnome_extensions.sh | 2 +- bin/helpers/keyboard_shortcuts.sh | 4 +- bin/helpers/ohmyzsh.sh | 2 +- bin/helpers/pipx_packages.sh | 2 +- bin/helpers/rust.sh | 2 +- bin/helpers/tailscale.sh | 2 +- bin/helpers/user_groups.sh | 2 +- bin/helpers/vscode-extensions.sh | 2 +- config/config.yaml | 11 +-- setup.sh | 2 +- 29 files changed, 132 insertions(+), 167 deletions(-) create mode 100644 .bashrc delete mode 100755 .zshrc diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..a55da6e --- /dev/null +++ b/.bashrc @@ -0,0 +1,93 @@ +# HISTFILE Configuration (Bash equivalent) +HISTFILE=~/.bash_history +HISTSIZE=1000 +HISTFILESIZE=2000 # Adjusted to match both histfile and size criteria + +# Alias Definitions +alias docker-compose='docker compose' +alias gg='git pull' +alias gl='git log --stat' +alias l="eza --header --long --git --group-directories-first --group --icons --color=always --sort=name --hyperlink -o --no-permissions" +alias ll='l' +alias la='l -a' +alias ddpul='docker compose down && docker compose pull && docker compose up -d && docker compose logs -f' +alias cat='bat' + +# Docker Aliases +alias d='docker' +alias dc='docker compose' +alias dce='docker compose exec' +alias dcl='docker compose logs' +alias dcd='docker compose down' +alias dcu='docker compose up' +alias dcp='docker compose ps' +alias dcps='docker compose ps' +alias dcr='docker compose run' + +# Git aliases +alias g='git' +alias gs='git status -s' +alias gst='git status' +alias ga='git add' +alias gc='git commit' +alias gcm='git commit -m' +alias gco='git checkout' +alias gcb='git checkout -b' + +# netstat port in use check +alias port='netstat -atupn | grep LISTEN' + +# Hotkeys daemon +alias hk='dotf hotkey-daemon' + +# Alias for ls to l but only if it's an interactive shell because we don't want to override ls in scripts which could blow up in our face +if [ -t 1 ]; then + alias ls='l' +fi + +# Alias for ssh.exe and ssh-add.exe on Windows WSL (microsoft-standard-WSL2) +if [[ $(uname -a) == *"microsoft-standard-WSL2"* ]]; then + source $HOME/.agent-bridge.sh + alias op='op.exe' +fi + +# PATH Manipulation +export PATH=$PATH:$HOME/.local/bin +export PATH=$PATH:$HOME/.cargo/bin +export PATH=$PATH:$HOME/dotfiles/bin + +# Go Configuration +export GOPATH=$HOME/.go +export GOROOT=$HOME/.go-root +export PATH=$PATH:$GOROOT/bin:$GOPATH/bin + +# Tradaware / DiscountOffice Configuration +if [ -d "/home/menno/Projects/Work" ]; then + export TRADAWARE_FROM_SOURCE=true +fi + +# pyenv Configuration +export PYENV_ROOT="$HOME/.pyenv" +if [[ -d $PYENV_ROOT/bin ]]; then + export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init --path)" +fi + +# Flutter Environment +if [ -d "$HOME/flutter" ]; then + export PATH="$PATH:$HOME/flutter/bin" + export CHROME_EXECUTABLE=/usr/bin/brave-browser +fi + +# 1Password Source Plugin (Assuming bash compatibility) +if [ -f /home/menno/.config/op/plugins.sh ]; then + source /home/menno/.config/op/plugins.sh +fi + +# Starship Prompt Initialization (Adapted for Bash) +eval "$(starship init bash)" + +# Display a welcome message for interactive shells +if [ -t 1 ]; then + dotf term +fi diff --git a/.zshrc b/.zshrc deleted file mode 100755 index e593a5f..0000000 --- a/.zshrc +++ /dev/null @@ -1,125 +0,0 @@ -HISTFILE=~/.histfile -HISTSIZE=1000 -SAVEHIST=1000 -bindkey -v -zstyle :compinstall filename '/home/menno/.zshrc' - -autoload -Uz compinit -compinit - -# Oh My Zsh installation -export ZSH="$HOME/.oh-my-zsh" -ZSH_THEME="robbyrussell" -ENABLE_CORRECTION="false" - -plugins=( - git - docker - 1password - ubuntu - sudo - screen - brew - ufw - zsh-interactive-cd - zsh-navigation-tools - yarn - vscode - composer - laravel - golang - httpie -) - -source $ZSH/oh-my-zsh.sh -eval "$(starship init zsh)" - -##################### -# PATH Manipulation # -##################### - -# Add ~/.local/bin to PATH -export PATH=$PATH:$HOME/.local/bin - -# Add ~/.cargo/bin to PATH -export PATH=$PATH:$HOME/.cargo/bin - -# Add dotfiles bin to PATH -export PATH=$PATH:$HOME/dotfiles/bin - -##################### -# Alias Definitions # -##################### - -# Aliases -alias docker-compose='docker compose' -alias gg='git pull' -alias gl='git log --stat' -alias l='eza --header --long --git --group-directories-first --group --icons --color=always --sort=name --hyperlink -o --no-permissions' -alias ll='l' -alias la='l -a' -alias ddpul='docker compose down && docker compose pull && docker compose up -d && docker compose logs -f' -alias cat='bat' - -# Docker Aliases -alias d='docker' -alias dc='docker compose' -alias dce='docker compose exec' -alias dcl='docker compose logs' -alias dcd='docker compose down' -alias dcu='docker compose up' -alias dcp='docker compose ps' -alias dcps='docker compose ps' -alias dcr='docker compose run' - -# Hotkeys daemon -alias hk='dotf hotkey-daemon' - -# Alias for ls to l but only if it's a interactive shell because we don't want to override ls in scripts which could blow up in our face -if [ -t 1 ]; then - alias ls='l' -fi - -# Alias for ssh.exe and ssh-add.exe on Windows WSL (microsoft-standard-WSL2) -if [[ $(uname -a) == *"microsoft-standard-WSL2"* ]]; then - alias op='op.exe' -fi - -###################### -# Export Definitions # -###################### - -# Tradaware / DiscountOffice -if [ -d "/home/menno/Projects/Work" ]; then - export TRADAWARE_PATH=/home/menno/Projects/Work - source $TRADAWARE_PATH/bin/helpers/source.sh - export PATH=$PATH:$TRADAWARE_PATH/bin/utilities -fi - -# pyenv -export PYENV_ROOT="$HOME/.pyenv" -[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(pyenv init -)" - -# Rocm related workaround -export HSA_OVERRIDE_GFX_VERSION=11.0.0 - -# If $HOME/flutter exists, add it to the PATH -if [ -d "$HOME/flutter" ]; then - export PATH="$PATH:$HOME/flutter/bin" -fi - -# Flutter related environment variables -export CHROME_EXECUTABLE=/usr/bin/brave-browser - -# 1Password source gh plugin -source /home/menno/.config/op/plugins.sh - -##################### -# End of the line...# -##################### - -# Show welcome message, but only if the terminal is interactive -if [ -t 1 ]; then - dotf term -fi diff --git a/bin/actions/export.sh b/bin/actions/export.sh index 59d73d8..b576f2a 100755 --- a/bin/actions/export.sh +++ b/bin/actions/export.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/actions/hotkey-daemon.sh b/bin/actions/hotkey-daemon.sh index dc3cbf2..2aa46bd 100755 --- a/bin/actions/hotkey-daemon.sh +++ b/bin/actions/hotkey-daemon.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/actions/push.sh b/bin/actions/push.sh index 0f69a85..1f439be 100755 --- a/bin/actions/push.sh +++ b/bin/actions/push.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/actions/secrets.sh b/bin/actions/secrets.sh index 892626c..39dfedf 100755 --- a/bin/actions/secrets.sh +++ b/bin/actions/secrets.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/actions/startup.sh b/bin/actions/startup.sh index a83389b..c870dfd 100755 --- a/bin/actions/startup.sh +++ b/bin/actions/startup.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh @@ -76,7 +76,7 @@ run_startup_scripts() { touch $HOME/dotfiles/logs/startup/$command_key.log # Run the command in a new screen session named after the command_key - screen -dmS $command_key zsh -c "eval $command > $HOME/dotfiles/logs/startup/$command_key.log 2>&1" + screen -dmS $command_key bash -c "eval $command > $HOME/dotfiles/logs/startup/$command_key.log 2>&1" sleep $(echo "scale=2; $delay_between_ms / 1000" | bc) if ! screen -list | grep -q $command_key; then diff --git a/bin/actions/status.sh b/bin/actions/status.sh index c94908c..656a2d9 100755 --- a/bin/actions/status.sh +++ b/bin/actions/status.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh source $HOME/dotfiles/bin/helpers/keyboard_shortcuts.sh diff --git a/bin/actions/term.sh b/bin/actions/term.sh index a3d14d2..877c362 100755 --- a/bin/actions/term.sh +++ b/bin/actions/term.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/actions/update.sh b/bin/actions/update.sh index ead37ba..4d1a7e9 100755 --- a/bin/actions/update.sh +++ b/bin/actions/update.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh @@ -173,10 +173,6 @@ tailscalecmd() { } extensions() { - printfe "%s\n" "cyan" "Ensuring Oh My Zsh is installed..." - source $HOME/dotfiles/bin/helpers/ohmyzsh.sh - ensure_ohmyzsh_installed - printfe "%s\n" "cyan" "Ensuring GNOME Extensions are installed..." source $HOME/dotfiles/bin/helpers/gnome_extensions.sh ensure_gnome_extensions_installed @@ -234,12 +230,12 @@ terminal() { } default_shell() { - printfe "%s\n" "cyan" "Setting zsh as default shell..." - if [ "$SHELL" != "/usr/bin/zsh" ]; then - printfe "%s\n" "yellow" " - Setting zsh as default shell" - chsh -s /usr/bin/zsh + printfe "%s\n" "cyan" "Setting bash as default shell..." + if [ "$SHELL" != "/usr/bin/bash" ]; then + printfe "%s\n" "yellow" " - Setting bash as default shell" + chsh -s /usr/bin/bash else - printfe "%s\n" "green" " - zsh is already the default shell" + printfe "%s\n" "green" " - bash is already the default shell" fi } diff --git a/bin/dotf b/bin/dotf index 8aaf03e..b3305db 100755 --- a/bin/dotf +++ b/bin/dotf @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh export DOTFILES_CONFIG=$HOME/dotfiles/config/config.yaml diff --git a/bin/dotf-screenshot b/bin/dotf-screenshot index e5cb4b7..a71572f 100755 --- a/bin/dotf-screenshot +++ b/bin/dotf-screenshot @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash # In case we run Pop!_OS let's use `cosmic-screenshot --interactive`, otherwise default to `flameshot gui` if [[ -x "$(command -v cosmic-screenshot)" ]]; then diff --git a/bin/helpers/apt_packages.sh b/bin/helpers/apt_packages.sh index 113216c..9fd16da 100755 --- a/bin/helpers/apt_packages.sh +++ b/bin/helpers/apt_packages.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/cargo_packages.sh b/bin/helpers/cargo_packages.sh index bfbd64f..845acd1 100755 --- a/bin/helpers/cargo_packages.sh +++ b/bin/helpers/cargo_packages.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/docker.sh b/bin/helpers/docker.sh index c718d4a..17f4d3c 100755 --- a/bin/helpers/docker.sh +++ b/bin/helpers/docker.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash ensure_docker_installed() { # if docker is already installed, skip the installation diff --git a/bin/helpers/flatpak_packages.sh b/bin/helpers/flatpak_packages.sh index 309a1d9..4fac2c4 100755 --- a/bin/helpers/flatpak_packages.sh +++ b/bin/helpers/flatpak_packages.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/fonts.sh b/bin/helpers/fonts.sh index b7d0d71..a941593 100755 --- a/bin/helpers/fonts.sh +++ b/bin/helpers/fonts.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/functions.sh b/bin/helpers/functions.sh index 7e69487..3b9a6f4 100755 --- a/bin/helpers/functions.sh +++ b/bin/helpers/functions.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash #Color print function, usage: println "message" "color" println() { diff --git a/bin/helpers/git.sh b/bin/helpers/git.sh index b08d315..aa2b26a 100755 --- a/bin/helpers/git.sh +++ b/bin/helpers/git.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/gnome_extensions.sh b/bin/helpers/gnome_extensions.sh index 8f3cc77..f7b3cc8 100755 --- a/bin/helpers/gnome_extensions.sh +++ b/bin/helpers/gnome_extensions.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/keyboard_shortcuts.sh b/bin/helpers/keyboard_shortcuts.sh index 5b75928..3aee43c 100755 --- a/bin/helpers/keyboard_shortcuts.sh +++ b/bin/helpers/keyboard_shortcuts.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh @@ -48,7 +48,7 @@ ensure_keyboard_shortcuts() { # Start swhkd printfe "%s\n" "green" " - starting swhkd..." printfe "%s\n" "yellow" " Note: this will likely show a password prompt, please enter your password" - screen -dmS swhkd zsh -c "$HOME/dotfiles/bin/actions/hotkey-daemon.sh" + screen -dmS swhkd bash -c "$HOME/dotfiles/bin/actions/hotkey-daemon.sh" # Check if this is gnome DESKTOP_SESSION is gnome, if not we can stop here # The next part is just for setting up custom shortcuts in GNOME diff --git a/bin/helpers/ohmyzsh.sh b/bin/helpers/ohmyzsh.sh index b941c3a..8b4b18b 100755 --- a/bin/helpers/ohmyzsh.sh +++ b/bin/helpers/ohmyzsh.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/pipx_packages.sh b/bin/helpers/pipx_packages.sh index f794e31..63cb054 100755 --- a/bin/helpers/pipx_packages.sh +++ b/bin/helpers/pipx_packages.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/rust.sh b/bin/helpers/rust.sh index 3b7d058..61b5541 100755 --- a/bin/helpers/rust.sh +++ b/bin/helpers/rust.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/tailscale.sh b/bin/helpers/tailscale.sh index c1f0b04..cf6ea7b 100755 --- a/bin/helpers/tailscale.sh +++ b/bin/helpers/tailscale.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash ensure_tailscale_installed() { # if tailscale is already installed, skip the installation diff --git a/bin/helpers/user_groups.sh b/bin/helpers/user_groups.sh index 6c80b6c..30051dd 100755 --- a/bin/helpers/user_groups.sh +++ b/bin/helpers/user_groups.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/bin/helpers/vscode-extensions.sh b/bin/helpers/vscode-extensions.sh index ae20fba..c0c210b 100755 --- a/bin/helpers/vscode-extensions.sh +++ b/bin/helpers/vscode-extensions.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash source $HOME/dotfiles/bin/helpers/functions.sh diff --git a/config/config.yaml b/config/config.yaml index ca2866a..1f6664a 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -36,10 +36,10 @@ config: target: ~/.ssh/authorized_keys chmod: 600 - # Zshrc - zshrc: - source: ~/dotfiles/.zshrc - target: ~/.zshrc + # bashrc + bashrc: + source: ~/dotfiles/.bashrc + target: ~/.bashrc # VSCode settings vscode: @@ -161,7 +161,8 @@ config: apt: repos: apps: - - zsh + - bash + - bash-completion - solaar - git - curl diff --git a/setup.sh b/setup.sh index 8c9a570..0905d1b 100755 --- a/setup.sh +++ b/setup.sh @@ -2,7 +2,7 @@ # Prepare, we need at least these minimal packages to continue ... sudo apt update -sudo apt install curl zsh nala pipx apt-transport-https ca-certificates gnupg -y +sudo apt install curl nala pipx apt-transport-https ca-certificates gnupg -y # Ensure shyaml is available echo "Ensuring shyaml is installed..."