37 lines
926 B
Diff
37 lines
926 B
Diff
From f64c64e433ec0f823b1d89051421c427280a0036 Mon Sep 17 00:00:00 2001
|
|
From: PeterMocary <petermocary@gmail.com>
|
|
Date: Mon, 23 May 2022 11:10:04 +0200
|
|
Subject: [PATCH 9/9] Add root privileges check at the leapp start
|
|
|
|
---
|
|
leapp/cli/__init__.py | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/leapp/cli/__init__.py b/leapp/cli/__init__.py
|
|
index 8c44cd4..2ffa4c7 100644
|
|
--- a/leapp/cli/__init__.py
|
|
+++ b/leapp/cli/__init__.py
|
|
@@ -2,6 +2,7 @@
|
|
import os
|
|
import pkgutil
|
|
import socket
|
|
+import sys
|
|
|
|
from leapp import VERSION
|
|
from leapp.cli import commands
|
|
@@ -32,6 +33,11 @@ def main():
|
|
"""
|
|
leapp entry point
|
|
"""
|
|
+
|
|
+ if os.getuid() != 0:
|
|
+ sys.stderr.write('Leapp has to be executed with root privileges.\n')
|
|
+ sys.exit(1)
|
|
+
|
|
os.environ['LEAPP_HOSTNAME'] = socket.getfqdn()
|
|
_load_commands(cli.command)
|
|
cli.command.execute('leapp version {}'.format(VERSION))
|
|
--
|
|
2.35.3
|
|
|