addet repetetive code..g
This commit is contained in:
parent
5b3ca14f38
commit
d25618deb0
1 changed files with 16 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue