changed packager alias creation
This commit is contained in:
parent
d86edfadfe
commit
748f91e772
1 changed files with 72 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
__autopackager__() {
|
||||
__getOS-Release__() {
|
||||
# # Ensure _sudo is set
|
||||
# [ -z "${_sudo+x}" ] && _sudo="sudo"
|
||||
|
||||
|
@ -70,6 +70,75 @@ __autopackager__() {
|
|||
esac
|
||||
}
|
||||
|
||||
__getPackager__() {
|
||||
local packager="apt pacman dnf zypper apk"
|
||||
for pkg in $packager; do
|
||||
if command_exists "$pkg"; then
|
||||
export PACKAGER="$pkg"
|
||||
fi
|
||||
done
|
||||
|
||||
case "$PACKAGER" in
|
||||
apt)
|
||||
if command_exists nala; then
|
||||
echo_info "Using nala for package management"
|
||||
alias search="nala search"
|
||||
alias install="$_sudo nala install --assume-yes"
|
||||
alias update="$_sudo nala update && $_sudo nala upgrade --full"
|
||||
alias remove="$_sudo nala purge"
|
||||
else
|
||||
echo_info "Using apt for package management"
|
||||
alias search="apt-cache search"
|
||||
alias install="$_sudo apt-get install --yes"
|
||||
alias update="$_sudo apt-get update && $_sudo apt-get upgrade"
|
||||
alias remove="$_sudo apt-get purge"
|
||||
fi
|
||||
alias unbreak="$_sudo dpkg --configure -a"
|
||||
;;
|
||||
pacman)
|
||||
if command_exists paru; then
|
||||
echo_info "Using paru for package management"
|
||||
alias search="paru -Ss"
|
||||
alias install="paru -S --noconfirm"
|
||||
alias update="paru -Syu"
|
||||
alias remove="paru -R"
|
||||
elif command_exists yay; then
|
||||
echo_info "Using yay for package management"
|
||||
alias search="yay -Ss"
|
||||
alias install="yay -S --noconfirm"
|
||||
alias update="yay -Syu"
|
||||
alias remove="yay -R"
|
||||
else
|
||||
echo_info "Using pacman for package management"
|
||||
alias search="$_sudo pacman -Ss"
|
||||
alias install="$_sudo pacman -S --noconfirm"
|
||||
alias update="$_sudo pacman -Syu"
|
||||
alias remove="$_sudo pacman -R"
|
||||
fi
|
||||
;;
|
||||
dnf)
|
||||
echo_info "Using dnf for package management"
|
||||
alias search="dnf search"
|
||||
alias install="$_sudo dnf install -y --skip-missing"
|
||||
alias update="$_sudo dnf update -y"
|
||||
alias remove="$_sudo dnf remove -y"
|
||||
;;
|
||||
zypper)
|
||||
echo_info "Using zypper for package management"
|
||||
alias search="zypper search"
|
||||
alias install="$_sudo zypper install --no-confirm"
|
||||
alias update="$_sudo zypper update"
|
||||
alias remove="$_sudo zypper remove"
|
||||
;;
|
||||
apk)
|
||||
echo_info "Using apk for package management"
|
||||
alias install="$_sudo apk add"
|
||||
alias update="$_sudo apk update && $_sudo apk upgrade"
|
||||
alias remove="$_sudo apk del"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_alias() {
|
||||
alias please="sudo"
|
||||
|
||||
|
@ -393,7 +462,8 @@ _coding_() {
|
|||
}
|
||||
|
||||
main() {
|
||||
__autopackager__
|
||||
# __getOS-Release__
|
||||
__getPackager__
|
||||
_alias
|
||||
_coding_
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue