addet repetetive code..g

This commit is contained in:
pika 2025-01-07 03:58:46 +01:00
parent 5b3ca14f38
commit d25618deb0

View file

@ -1,3 +1,19 @@
# ─< Check if the user is root and set sudo variable if necessary >───────────────────────
check_root() {
if [ "$(id -u)" -ne 0 ]; then
if command_exists sudo; then
echo_warning "User is not root. Using sudo for privileged operations."
_sudo="sudo"
else
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
}
__autopackager__() {
. /etc/os-release
case "$ID" in