diff options
Diffstat (limited to '')
-rw-r--r-- | dot_config/zsh/aliasrc | 2 | ||||
-rw-r--r-- | dot_config/zsh/dot_zshenv | 2 | ||||
-rw-r--r-- | dot_config/zsh/dot_zshrc | 7 | ||||
-rw-r--r-- | dot_local/bin/executable_update | 92 |
4 files changed, 99 insertions, 4 deletions
diff --git a/dot_config/zsh/aliasrc b/dot_config/zsh/aliasrc index 5b933ed..75903ee 100644 --- a/dot_config/zsh/aliasrc +++ b/dot_config/zsh/aliasrc @@ -12,7 +12,7 @@ # sudo not required for some system commands for x in mount umount sv emerge apt pacman updatedb su ; do # shellcheck disable=SC2139 - alias $x='sudo $x' + alias $x="sudo $x" done if command -v doas >/dev/null 2>&1 diff --git a/dot_config/zsh/dot_zshenv b/dot_config/zsh/dot_zshenv index 29838fc..47236cf 100644 --- a/dot_config/zsh/dot_zshenv +++ b/dot_config/zsh/dot_zshenv @@ -16,7 +16,7 @@ else fi # Use TUI editor for git -export GIT_EDITOR="$EDITOR" +[ -z "$GIT_EDITOR" ] && export GIT_EDITOR="$EDITOR" # Default programs for SSH or not if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then export BROWSER="w3m" diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc index a592706..296d368 100644 --- a/dot_config/zsh/dot_zshrc +++ b/dot_config/zsh/dot_zshrc @@ -39,8 +39,11 @@ setopt interactive_comments setopt complete_aliases # History in cache directory: -HISTSIZE=100000000 -SAVEHIST=100000000 +HISTSIZE=999999999 +SAVEHIST=$HISTSIZE +if [ -z "$XDG_STATE_HOME/zsh" ]; then + mkdir -p "$XDG_STATE_HOME/zsh" +fi HISTFILE="$XDG_STATE_HOME"/zsh/history setopt BANG_HIST # Treat the '!' character specially during expansion. setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format. diff --git a/dot_local/bin/executable_update b/dot_local/bin/executable_update new file mode 100644 index 0000000..1c36665 --- /dev/null +++ b/dot_local/bin/executable_update @@ -0,0 +1,92 @@ +#!/bin/sh + +set -e + +# if doas is installed, use it instead of sudo +if [ -x "$(command -v doas)" ]; then + sudo() { + doas "$@" + } +fi + +# Get current Distro +if [ -f /etc/os-release ]; then + . /etc/os-release + if [ -z "$ID_LIKE" ]; then + ID_LIKE="" + fi +else + ID=$(uname -s) +fi + +UPDATED=0 + +set -- "$ID" "$ID_LIKE" +for i in "$@"; do + case "$i" in + # YUNO use ID_LIKE, chimera :( + alpine | chimera) + sudo apk update || return 1 + sudo apk upgrade || return 1 + UPDATED=1 + ;; + arch) + # TODO: Find a way to prefer one over the other besides hardcoding + if [ -x "$(command -v yay)" ]; then + yay -Syu || return 1 + yay -Yc || return 1 + elif [ -x "$(command -v paru)" ]; then + paru -Syu || return 1 + paru -c || return 1 + else + sudo pacman -Syu || return 1 + fi + UPDATED=1 + ;; + Darwin) + brew update || return 1 + brew upgrade -g || return 1 + brew cleanup || return 1 + UPDATED=1 + ;; + debian) + sudo apt update || return 1 + sudo apt dist-upgrade || return 1 + sudo apt autoremove || return 1 + UPDATED=1 + ;; + gentoo) + sudo emaint -a sync || return 1 + sudo emerge -avuDU --changed-use @world || return 1 + sudo emerge -av --depclean || return 1 + UPDATED=1 + ;; + opensuse) + sudo zypper refresh || return 1 + sudo zypper update || return 1 + sudo zypper clean -a || return 1 + UPDATED=1 + ;; + *) ;; + esac + if [ "$UPDATED" -eq 1 ]; then + break + fi +done + +# Update flatpaks, if flatpak is installed +if [ -x "$(command -v flatpak)" ]; then + flatpak update || return 1 + UPDATED=1 +fi + +# Update snaps, if snap is installed +if [ -x "$(command -v snap)" ]; then + sudo snap refresh || return 1 + UPDATED=1 +fi + +if [ "$UPDATED" -eq 0 ]; then + echo "No package managers found!" + exit 1 +fi |