aliases/package-manager: Use _omb_util_binary_exists for testing command existence

This commit is contained in:
Koichi Murase
2022-02-22 18:43:38 +09:00
parent 92823a2840
commit 0646c47f30
+7 -8
View File
@@ -3,12 +3,12 @@
# ---------------------------------------------------------------------------
# Logic for root usage
if [ -n "$EUID" ] && [ -x $(command -v sudo) ]; then
if [ -n "$EUID" ] && _omb_util_binary_exists emerge sudo; then
[ -z "$OMB_USE_ROOT" ] && export OMB_ROOT=true
fi
# Portage - Enoch Merge
if [[ -x "$(command -v emerge)" ]]; then
if _omb_util_binary_exists emerge; then
alias em="${OMB_ROOT:+sudo }emerge" # Enoch Merge
alias es="${OMB_ROOT:+sudo }emerge --search" # Enoch Search
alias esync="${OMB_ROOT:+sudo }emerge --sync" # Enoch SYNC
@@ -20,7 +20,7 @@ if [[ -x "$(command -v emerge)" ]]; then
fi
# Paludis - Cave
if [[ -x "$(command -v cave)" ]]; then
if _omb_util_binary_exists cave; then
alias cave="${OMB_ROOT:+sudo }cave"
alias cr="${OMB_ROOT:+sudo }cave resolve" # Cave Resolve
alias cui="${OMB_ROOT:+sudo }cave uninstall" # Cave UnInstall
@@ -29,7 +29,7 @@ if [[ -x "$(command -v cave)" ]]; then
fi
# Advanced Packaging Tool - APT
if [[ -x "$(command -v apt)" ]]; then
if _omb_util_binary_exists apt; then
alias apt="${OMB_ROOT:+sudo }apt" # Advanced Packaging Tool
alias aptfu="${OMB_ROOT:+sudo }apt update -y && ${OMB_ROOT:+sudo }apt upgrade -y && ${OMB_ROOT:+sudo }apt dist-upgrade -y && ${OMB_ROOT:+sudo }apt autoremove -y"
alias apti="${OMB_ROOT:+sudo }apt install -y" # Apt install
@@ -40,20 +40,19 @@ if [[ -x "$(command -v apt)" ]]; then
fi
# Debian PacKaGe - DPKG
if [[ -x "$(command -v dpkg)" ]]; then
if _omb_util_binary_exists dpkg; then
alias dpkg="${OMB_ROOT:+sudo }dpkg"
fi
# # Zypper = Zen Yast Package Program (ZYPP?)
# if [[ -x "$(command -v zypper)" ]]; then
#
# if _omb_util_binary_exists zypper; then
# # Yast = Yet Another Silly/Setup Thing/Thing
# alias lcp="${OMB_ROOT:+sudo }zypper"
# alias lcpi="${OMB_ROOT:+sudo }zypper install"
# alias lcps="${OMB_ROOT:+sudo }zypper search"
# alias lcpsi="${OMB_ROOT:+sudo }zypper source-install"
# alias lcpr="${OMB_ROOT:+sudo }zypper remove"
# if [[ $(cat /etc/os-release | grep -m 1 -o 'openSUSE Tumbleweed') == "openSUSE Tumbleweed" ]]; then
# if grep -q 'openSUSE Tumbleweed' /etc/os-release; then
# # Zypper update kills the system - LCP
# alias lcpfu="${OMB_ROOT:+sudo }zypper dup"
# # Because Geeko uses sublime3 to call sublime_text instead of something that makes sence like 'subl'..