mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
f6926e85ee
Move the functionality that checks for root permissions into a plugin. Signed-off-by: Brenda J. Butler <bjb@mojatatu.com> Acked-by: Lucas Bates <lucasb@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
20 lines
493 B
Python
20 lines
493 B
Python
import os
|
|
import sys
|
|
from TdcPlugin import TdcPlugin
|
|
|
|
from tdc_config import *
|
|
|
|
|
|
class SubPlugin(TdcPlugin):
|
|
def __init__(self):
|
|
self.sub_class = 'root/SubPlugin'
|
|
super().__init__()
|
|
|
|
def pre_suite(self, testcount, testidlist):
|
|
# run commands before test_runner goes into a test loop
|
|
super().pre_suite(testcount, testidlist)
|
|
|
|
if os.geteuid():
|
|
print('This script must be run with root privileges', file=sys.stderr)
|
|
exit(1)
|