fixed packager
This commit is contained in:
parent
fd90802d24
commit
f32dd9d55a
1 changed files with 87 additions and 46 deletions
133
.bashrc
133
.bashrc
|
@ -109,22 +109,95 @@ _source() {
|
|||
}
|
||||
|
||||
_sources() {
|
||||
local sourceDir="$HOME/.bash"
|
||||
local sourceOptions=(
|
||||
# "aliases"
|
||||
# "defaults"
|
||||
"installs"
|
||||
_source "$HOME/.bash_aliases"
|
||||
}
|
||||
|
||||
setup-pkg() {
|
||||
case "$1" in
|
||||
apt)
|
||||
install() {
|
||||
if command-exists nala; then
|
||||
$_sudo nala install --assume-yes "$@"
|
||||
else
|
||||
$_sudo apt install --color=always --assume-yes "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
if command_exists nala; then
|
||||
alias search="nala search"
|
||||
alias update="$_sudo nala update && $_sudo nala upgrade --full"
|
||||
alias remove="$_sudo nala purge"
|
||||
else
|
||||
alias search="apt-cache search"
|
||||
alias update="$_sudo apt update && $_sudo apt upgrade"
|
||||
alias remove="$_sudo apt purge"
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
pacman)
|
||||
install() {
|
||||
if command_exists paru; then
|
||||
paru -S --no-confirm --color=always "$@"
|
||||
elif command_exists yay; then
|
||||
yay -S --no-confirm --color=always "$@"
|
||||
else
|
||||
$_sudo pacman -S --no-confirm --color=always "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
if command_exists paru; then
|
||||
alias search="paru -Ss"
|
||||
alias update="paru -Syu"
|
||||
alias remove="paru -R"
|
||||
elif command_exists yay; then
|
||||
alias search="yay -Ss"
|
||||
alias update="yay -Syu"
|
||||
alias remove="yay -R"
|
||||
else
|
||||
alias search="pacman -Ss"
|
||||
alias update="$_sudo pacman -Syu"
|
||||
alias remove="$_sudo pacman -R"
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
dnf)
|
||||
alias install="$_sudo dnf install"
|
||||
alias search="pacman -Ss"
|
||||
alias update="$_sudo pacman -Syu"
|
||||
alias remove="$_sudo pacman -R"
|
||||
return 0
|
||||
;;
|
||||
zypper)
|
||||
alias install="$_sudo zypper install"
|
||||
alias search="zypper search"
|
||||
alias update="$_sudo zypper dup"
|
||||
alias remove="$_sudo zypper remove"
|
||||
return 0
|
||||
;;
|
||||
apk)
|
||||
alias install="$_sudo apk add"
|
||||
alias search="apk search"
|
||||
alias update="$_sudo apk update && $_sudo apk upgrade"
|
||||
alias remove="$_sudo apk del"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
local pkg=() p
|
||||
|
||||
pkg=(
|
||||
apt
|
||||
dnf
|
||||
pacman
|
||||
zypper
|
||||
apk
|
||||
)
|
||||
|
||||
[[ -e "$HOME/.bash_aliases" ]] &&
|
||||
. "$HOME/.bash_aliases"
|
||||
|
||||
for _s in "${sourceOptions[@]}"; do
|
||||
local _sourceFile="${sourceDir}/.${_s}.sh"
|
||||
if [ -e "$_sourceFile" ]; then
|
||||
. "$_sourceFile"
|
||||
for p in "${pkg[@]}"; do
|
||||
if command_exists $p; then
|
||||
setup-pkg $p
|
||||
break
|
||||
fi
|
||||
local _source_""
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -192,38 +265,6 @@ _init() {
|
|||
fi
|
||||
}
|
||||
|
||||
# ─< ble.sh -- https://github.com/akinomyoga/ble.sh >─────────────────────────────────────
|
||||
# d_blesh() {
|
||||
# for deeps in git make gawk; do
|
||||
# if ! command_exists $deeps; then
|
||||
# echo_error "$deeps was missing from the system, cannot setup shell properly! (blesh setup)"
|
||||
# exit 1
|
||||
# fi
|
||||
# done
|
||||
# }
|
||||
|
||||
# i_blesh() {
|
||||
# local tmp_dir="$(mktemp -d)"
|
||||
#
|
||||
# cd "$tmp_dir" || echo_error "$tmp_dir is not valid!"
|
||||
# git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
|
||||
# make -C ble.sh install PREFIX=~/.local
|
||||
# . "$HOME/.local/share/blesh/ble.sh"
|
||||
# # bash
|
||||
# # cd "$HOME" || return 0
|
||||
# }
|
||||
|
||||
# _blesh() {
|
||||
# if [ ! -f $HOME/.local/share/blesh/ble.sh ]; then
|
||||
# d_blesh # Dependency check for blesh
|
||||
# echo_info "Installing blesh.. Depending on your internet connection and the performance of the client, this could take a minute or two.."
|
||||
# i_blesh # installing blesh silently
|
||||
# else
|
||||
# # . "$HOME/.local/share/blesh/ble.sh" --attach=none
|
||||
# . "$HOME/.local/share/blesh/ble.sh"
|
||||
# fi
|
||||
# }
|
||||
|
||||
_env() {
|
||||
local essentials=(
|
||||
neovim
|
||||
|
@ -332,6 +373,7 @@ main() {
|
|||
_color_prompt_
|
||||
_env
|
||||
check_root
|
||||
setup-pkg
|
||||
_end
|
||||
|
||||
_source "$HOME/.bash_aliases"
|
||||
|
@ -348,7 +390,6 @@ main() {
|
|||
}
|
||||
|
||||
main
|
||||
|
||||
if $blesh; then
|
||||
set -o vi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue