changed the packager function a bit

This commit is contained in:
pika 2025-02-27 14:10:52 +01:00
parent c34fe00c1a
commit 85773caf45
2 changed files with 34 additions and 33 deletions

View file

@ -1,8 +1,15 @@
__autopackager__() { __autopackager__() {
. /etc/os-release # # Ensure _sudo is set
case "$ID" in # [ -z "${_sudo+x}" ] && _sudo="sudo"
# Debian-based
ubuntu | debian | pop | kali | zorin | rhinoh | raspbian) # Define command_exists if not already defined
# command_exists() { command -v "$1" >/dev/null 2>&1; }
# Load OS release information
[ -f /etc/os-release ] && . /etc/os-release || return 1
case "$ID_LIKE" in
*debian*)
if command_exists nala; then if command_exists nala; then
alias search="nala search" alias search="nala search"
alias install="$_sudo nala install --assume-yes" alias install="$_sudo nala install --assume-yes"
@ -17,8 +24,7 @@ __autopackager__() {
alias unbreak="$_sudo dpkg --configure -a" alias unbreak="$_sudo dpkg --configure -a"
;; ;;
# Arch-based *arch*)
arch | manjaro | endeavouros | garuda)
if command_exists paru; then if command_exists paru; then
alias search="paru -Ss" alias search="paru -Ss"
alias install="paru -S --noconfirm" alias install="paru -S --noconfirm"
@ -37,28 +43,30 @@ __autopackager__() {
fi fi
;; ;;
# RHEL-based *rhel* | *fedora*)
fedora | centos)
alias search="dnf search" alias search="dnf search"
alias install="$_sudo dnf install" alias install="$_sudo dnf install -y --skip-missing"
alias update="$_sudo dnf update" alias update="$_sudo dnf update -y"
alias remove="$_sudo dnf remove" alias remove="$_sudo dnf remove -y"
;; ;;
# openSUSE *suse*)
opensuse-*)
alias search="zypper search" alias search="zypper search"
alias install="$_sudo zypper install --no-confirm" alias install="$_sudo zypper install --no-confirm"
alias update="$_sudo zypper update" alias update="$_sudo zypper update"
alias remove="$_sudo zypper remove" alias remove="$_sudo zypper remove"
;; ;;
# Alpine *alpine*)
alpine)
alias install="$_sudo apk add" alias install="$_sudo apk add"
alias update="$_sudo apk update && $_sudo apk upgrade" alias update="$_sudo apk update && $_sudo apk upgrade"
alias remove="$_sudo apk del" alias remove="$_sudo apk del"
;; ;;
*)
echo "Unsupported distro: $ID"
return 1
;;
esac esac
} }
@ -149,25 +157,13 @@ _alias() {
ta() { ta() {
command tmux list-sessions >/dev/null 2>&1 command tmux list-sessions >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if command_exists notify-send; then echo "${tmux_y}"
notify-send "TMUX" "${tmux_y}" sleep 0.3
sleep 0.5
tmux attach tmux attach
else else
echo_info "${tmux_y}" echo "${tmux_n}"
sleep 0.5 sleep 0.3
tmux attach
fi
else
if command_exists notify-send; then
notify-send "TMUX" "${tmux_n}"
sleep 0.5
tmux tmux
else
echo_info "$tmux_n"
sleep 0.5
tmux
fi
fi fi
} }
alias ts="tmux source $HOME/.tmux.conf" alias ts="tmux source $HOME/.tmux.conf"

View file

@ -31,6 +31,11 @@ _install() {
--help | -h) --help | -h)
_help _help
;; ;;
nvim)
if _check; then
_install_func "neovim"
fi
;;
*) *)
if _check; then if _check; then
_install_func "$1" _install_func "$1"