renamed functions _install and _rename to pkg-install and pkg-rename
This commit is contained in:
parent
66299ddd7c
commit
e658c15358
1 changed files with 15 additions and 14 deletions
29
distros.sh
29
distros.sh
|
@ -137,7 +137,6 @@ source_script() {
|
|||
sleep 0.1
|
||||
return 0
|
||||
else
|
||||
echo_info "Sourcing external script:${NC} $url"
|
||||
# ─< if $1 is a url, grab it and source it, also deletes afterwards >─────────────────────
|
||||
if command_exists curl; then
|
||||
curl -fsSL $url -o $import
|
||||
|
@ -149,6 +148,8 @@ source_script() {
|
|||
fi
|
||||
|
||||
source "$import"
|
||||
|
||||
echo "${BLUE}Sourcing external script:${NC} $url"
|
||||
sleep 0.1
|
||||
rm -f "$import"
|
||||
fi
|
||||
|
@ -177,7 +178,7 @@ checkAndInstall() {
|
|||
# ─< if it's not a list, then just check and install the package.. >──────────────────────
|
||||
if [[ -z $2 ]]; then
|
||||
if ! command_exists "$1"; then
|
||||
if run-silent _install "$1"; then
|
||||
if run-silent pkg_install "$1"; then
|
||||
echo_pkg deps "$1 - ${GREEN}installed"
|
||||
else
|
||||
echo_pkg deps "$1 is already installed.."
|
||||
|
@ -192,7 +193,7 @@ checkAndInstall() {
|
|||
for deps in "${@}"; do
|
||||
# echo_pkg deps "Installing $deps"
|
||||
if ! command_exists $deps; then
|
||||
if run-silent _install "$deps"; then
|
||||
if run-silent pkg_install "$deps"; then
|
||||
echo_pkg deps "$deps - ${GREEN}installed"
|
||||
else
|
||||
echo_pkg deps "$deps is already installed.."
|
||||
|
@ -244,13 +245,13 @@ check_env() {
|
|||
|
||||
# CAUTION:
|
||||
# ╭─────────────────────────────────────────────────────────────────────╮
|
||||
# │ This can break really quickly, since the _remove() function removes │
|
||||
# │ This can break really quickly, since the pkg-remove() function removes │
|
||||
# │ without confirmation! use with CAUTION!! │
|
||||
# ╰─────────────────────────────────────────────────────────────────────╯
|
||||
_setup() {
|
||||
case "$1" in
|
||||
debian | ubuntu)
|
||||
_install() {
|
||||
pkg_install() {
|
||||
# $_sudo apt-get install --assume-yes "$@"
|
||||
if command_exists nala; then
|
||||
pkger=nala
|
||||
|
@ -262,7 +263,7 @@ _setup() {
|
|||
}
|
||||
|
||||
# CAUTION:
|
||||
_remove() {
|
||||
pkg-remove() {
|
||||
if command_exists nala; then
|
||||
pkger=nala
|
||||
$_sudo nala remove --assume-yes "$@"
|
||||
|
@ -277,13 +278,13 @@ _setup() {
|
|||
}
|
||||
;;
|
||||
fedora)
|
||||
_install() {
|
||||
pkg_install() {
|
||||
pkger=dnf
|
||||
$_sudo dnf -y install "$@"
|
||||
}
|
||||
|
||||
# CAUTION:
|
||||
_remove() {
|
||||
pkg-remove() {
|
||||
pkger=dnf
|
||||
$_sudo dnf -y remove "$@"
|
||||
}
|
||||
|
@ -297,7 +298,7 @@ _setup() {
|
|||
fi
|
||||
}
|
||||
|
||||
_install() {
|
||||
pkg_install() {
|
||||
if command_exists paru; then
|
||||
pkger=paru
|
||||
# echo_pkg "Using paru"
|
||||
|
@ -314,7 +315,7 @@ _setup() {
|
|||
}
|
||||
|
||||
# CAUTION:
|
||||
_remove() {
|
||||
pkg-remove() {
|
||||
if command_exists paru; then
|
||||
pkger=paru
|
||||
# echo_info "Using paru"
|
||||
|
@ -331,25 +332,25 @@ _setup() {
|
|||
}
|
||||
;;
|
||||
opensuse)
|
||||
_install() {
|
||||
pkg_install() {
|
||||
pkger=zypper
|
||||
$_sudo zypper in "$@"
|
||||
}
|
||||
|
||||
# CAUTION:
|
||||
_remove() {
|
||||
pkg-remove() {
|
||||
pkger=zypper
|
||||
$_sudo zypper rem "$@"
|
||||
}
|
||||
;;
|
||||
alpine)
|
||||
_install() {
|
||||
pkg_install() {
|
||||
pkger=apk
|
||||
apk add "$@"
|
||||
}
|
||||
|
||||
# CAUTION:
|
||||
_remove() {
|
||||
pkg-remove() {
|
||||
pkger=apk
|
||||
apk remove "$@"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue