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

View file

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