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