From 18c3ada59995b9670fa2ed38d1baf87d72a9d831 Mon Sep 17 00:00:00 2001 From: Candifloss Date: Sun, 3 Aug 2025 16:04:46 +0530 Subject: [PATCH] Updated distro-specific aliases --- conf.d/fish_alias_arch.fish | 4 --- conf.d/fish_alias_common.fish | 3 +- conf.d/fish_alias_deb.fish | 3 -- conf.d/fish_alias_distro.fish | 43 +++++++++++++++++++++++ conf.d/fish_alias_services.fish | 61 +++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 8 deletions(-) delete mode 100644 conf.d/fish_alias_arch.fish delete mode 100644 conf.d/fish_alias_deb.fish create mode 100644 conf.d/fish_alias_distro.fish create mode 100644 conf.d/fish_alias_services.fish diff --git a/conf.d/fish_alias_arch.fish b/conf.d/fish_alias_arch.fish deleted file mode 100644 index d4ab39a..0000000 --- a/conf.d/fish_alias_arch.fish +++ /dev/null @@ -1,4 +0,0 @@ -alias inst="sudo pacman -S" -alias systemctl="sudo systemctl" -alias updt="sudo pacman -Syuu --noconfirm && paru -Syu --noconfirm && rustup update" - diff --git a/conf.d/fish_alias_common.fish b/conf.d/fish_alias_common.fish index 469ea96..23b27ae 100644 --- a/conf.d/fish_alias_common.fish +++ b/conf.d/fish_alias_common.fish @@ -1,4 +1,5 @@ alias c="clear" alias systemctl="sudo systemctl" alias ls="lsd" -alias bat="bat -pP" +alias cat="bat -pP" +alias cleanup_media='find ~/Videos -type f \( -iname "*.txt" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.nfo" \) -exec rm -f {} +' diff --git a/conf.d/fish_alias_deb.fish b/conf.d/fish_alias_deb.fish deleted file mode 100644 index 17801c3..0000000 --- a/conf.d/fish_alias_deb.fish +++ /dev/null @@ -1,3 +0,0 @@ -alias inst="sudo apt-get install -y" -alias systemctl="sudo systemctl" -alias updt="sudo apt-get update && sudo apt-get upgrade -y && rustup update" diff --git a/conf.d/fish_alias_distro.fish b/conf.d/fish_alias_distro.fish new file mode 100644 index 0000000..d13e7db --- /dev/null +++ b/conf.d/fish_alias_distro.fish @@ -0,0 +1,43 @@ +# Manually set OS +set -gx OS "fedora" + +# Auto-detect if OS is not already set +if not set -q OS + if test -f /etc/os-release + set -l distro (grep "^ID=" /etc/os-release | cut -d= -f2 | tr -d '"') + set -gx OS $distro + else if test (uname) = "FreeBSD" + set -gx OS "freebsd" + end +end + +# Aliases based on OS +switch $OS + case debian + alias inst="sudo apt-get install -y" + alias updt="sudo apt-get update && sudo apt-get upgrade -y && rustup update" + case ubuntu + alias inst="sudo apt-get install -y" + alias updt="sudo apt-get update && sudo apt-get upgrade -y && sudo snap refresh && rustup update" + case arch manjaro + alias inst="sudo pacman -S" + alias updt="sudo pacman -Syuu --noconfirm && paru -Syu --noconfirm && rustup update" + case fedora + alias inst="sudo dnf install -y" + alias updt="sudo dnf upgrade -y && rustup update" + case rhel centos rocky almalinux + alias inst="sudo dnf install -y" + alias updt="sudo dnf upgrade -y && rustup update" + case opensuse tumbleweed + alias inst="sudo zypper install -y" + alias updt="sudo zypper refresh && sudo zypper update -y && rustup update" + case void + alias inst="sudo xbps-install -Sy" + alias updt="sudo xbps-install -Su && rustup update" + case alpine + alias inst="sudo apk add" + alias updt="sudo apk update && sudo apk upgrade && rustup update" + case freebsd + alias inst="sudo pkg install -y" + alias updt="sudo pkg update && sudo pkg upgrade -y && rustup update" +end diff --git a/conf.d/fish_alias_services.fish b/conf.d/fish_alias_services.fish new file mode 100644 index 0000000..1f64f72 --- /dev/null +++ b/conf.d/fish_alias_services.fish @@ -0,0 +1,61 @@ +# Manually override INIT system (optional) +set -gx INIT_SYSTEM "systemd" + +# Auto-detect init system if not set +if not set -q INIT_SYSTEM + if type -q systemctl + set -gx INIT_SYSTEM "systemd" + else if type -q rc-service + set -gx INIT_SYSTEM "openrc" + else if type -q sv + set -gx INIT_SYSTEM "runit" + else if test -x /etc/rc.d + set -gx INIT_SYSTEM "bsdrc" + else if test -x /etc/init.d + set -gx INIT_SYSTEM "sysvinit" + end +end + +# Set aliases based on init system +switch $INIT_SYSTEM + case systemd + alias ser_start="sudo systemctl start" + alias ser_restart="sudo systemctl restart" + alias ser_stop="sudo systemctl stop" + alias ser_status="sudo systemctl status" + alias ser_enable="sudo systemctl enable" + alias ser_disable="sudo systemctl disable" + + case openrc + alias ser_start="sudo rc-service" + alias ser_restart="sudo rc-service" + alias ser_stop="sudo rc-service" + alias ser_status="sudo rc-service" + alias ser_enable="sudo rc-update add" + alias ser_disable="sudo rc-update del" + + case runit + alias ser_start="sudo sv up" + alias ser_restart="sudo sv restart" + alias ser_stop="sudo sv down" + alias ser_status="sudo sv status" + alias ser_enable="ln -s /etc/sv" # manual step required + alias ser_disable="rm -f /var/service" + + case bsdrc + alias ser_start="sudo service" + alias ser_restart="sudo service" + alias ser_stop="sudo service" + alias ser_status="sudo service" + alias ser_enable="sudo sysrc" + alias ser_disable="sudo sysrc" + + case sysvinit + alias ser_start="sudo /etc/init.d" + alias ser_restart="sudo /etc/init.d" + alias ser_stop="sudo /etc/init.d" + alias ser_status="sudo /etc/init.d" + alias ser_enable="echo 'Enable manually with update-rc.d'" + alias ser_disable="echo 'Disable manually with update-rc.d'" +end +