mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-16 07:47:35 +01:00
Updated for root user
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
677e9d5d2b
commit
365c6e653e
1 changed files with 7 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
@ -788,6 +789,12 @@ def main() -> None:
|
|||
Raises:
|
||||
SystemExit: Exit code 0.
|
||||
"""
|
||||
error = Errors()
|
||||
|
||||
if not os.geteuid() == 0:
|
||||
error.raise_error_message(message='Must run as root.', exit_status=1)
|
||||
raise SystemExit('')
|
||||
|
||||
# Configure logging
|
||||
if Configs.error_log_file.is_file():
|
||||
Configs.error_log_file.unlink()
|
||||
|
@ -854,7 +861,6 @@ def main() -> None:
|
|||
arguments[args[0]]()
|
||||
except KeyError:
|
||||
logging.error("Exception occurred", exc_info=True)
|
||||
error = Errors()
|
||||
error.raise_error_message(message='Something went wrong, check the log file.', exit_status=1)
|
||||
except IndexError:
|
||||
usage.help_short(1)
|
||||
|
|
Loading…
Reference in a new issue