This commit is contained in:
pika 2025-04-06 21:01:21 +02:00
parent 81701228fd
commit 772cc70675

View file

@ -53,30 +53,30 @@ command_exists() {
} }
# ─────────────────────────────────────< get packager >───────────────────────────────────── # ─────────────────────────────────────< get packager >─────────────────────────────────────
checkPkg() { # checkPkg() {
for pkg in apt-get dnf pacman apk zypper; do for pkg in apt-get dnf pacman apk zypper; do
if command_exists $pkg; then if command_exists $pkg; then
printf "Using ${RED}${pkg}${NC} method.." printf "Using ${RED}${pkg}${NC} method.."
pkger="$pkg" pkger="$pkg"
fi fi
done done
} # }
# ─────────────────────────────────< check for root/sudo >─────────────────────────────── # ─────────────────────────────────< check for root/sudo >───────────────────────────────
checkRoot() { # checkRoot() {
if [ "$(id -u)" -ne 0 ]; then if [ "$(id -u)" -ne 0 ]; then
if command_exists sudo; then if command_exists sudo; then
echo_info "User is not root. Using sudo for privileged operations." echo_info "User is not root. Using sudo for privileged operations."
_sudo="sudo -E" _sudo="sudo -E"
else
echo_error "No sudo found and you're not root! Can't install packages."
return 1
fi
else else
echo_info "Root access confirmed." echo_error "No sudo found and you're not root! Can't install packages."
_sudo="" return 1
fi fi
} else
echo_info "Root access confirmed."
_sudo=""
fi
# }
# ╭─────╮ # ╭─────╮
# │ apt │ # │ apt │
@ -225,10 +225,10 @@ zypperBase() {
# │ FUNCTIONS │ # │ FUNCTIONS │
# ╰───────────╯ # ╰───────────╯
envCheck() { # envCheck() {
checkRoot # checkRoot
checkPkg # checkPkg
} # }
install_base() { install_base() {
envCheck envCheck