mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Update check for root privileges
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
ec2fed9019
commit
86758b2dd5
6 changed files with 39 additions and 22 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2.9.5 - 26/09/2015
|
||||||
|
Updated:
|
||||||
|
- Check for root privileges
|
||||||
|
|
||||||
2.9.4 - 24/09/2015
|
2.9.4 - 24/09/2015
|
||||||
Updated:
|
Updated:
|
||||||
- KeyboardInterrupt for main.py
|
- KeyboardInterrupt for main.py
|
||||||
|
|
|
@ -33,10 +33,11 @@ Slpkg is a user-friendly package manager for Slackware installations
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from slpkg.main import main
|
from slpkg.main import main
|
||||||
|
from slpkg.superuser import s_user
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
|
s_user()
|
||||||
main()
|
main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("")
|
print("")
|
||||||
|
|
|
@ -23,16 +23,6 @@
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import getpass
|
|
||||||
|
|
||||||
|
|
||||||
def s_user(user):
|
|
||||||
"""
|
|
||||||
Check for root user
|
|
||||||
"""
|
|
||||||
if user != "root":
|
|
||||||
print("\nslpkg: Error: Must have root privileges\n")
|
|
||||||
raise SystemExit()
|
|
||||||
|
|
||||||
|
|
||||||
def remove_repositories(repositories, default_repositories):
|
def remove_repositories(repositories, default_repositories):
|
||||||
|
@ -92,8 +82,6 @@ class MetaData(object):
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
|
||||||
s_user(getpass.getuser())
|
|
||||||
|
|
||||||
# Default Slackware release
|
# Default Slackware release
|
||||||
slack_rel = "stable"
|
slack_rel = "stable"
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import getpass
|
|
||||||
|
|
||||||
from slpkg.load import Regex
|
from slpkg.load import Regex
|
||||||
from slpkg.desc import PkgDesc
|
from slpkg.desc import PkgDesc
|
||||||
|
@ -688,7 +687,6 @@ class ArgParse(object):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
Msg().s_user(getpass.getuser())
|
|
||||||
args = sys.argv
|
args = sys.argv
|
||||||
args.pop(0)
|
args.pop(0)
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,6 @@ class Msg(object):
|
||||||
"""
|
"""
|
||||||
print("| Package {0} installed".format(pkg))
|
print("| Package {0} installed".format(pkg))
|
||||||
|
|
||||||
def s_user(self, user):
|
|
||||||
"""Check for root user
|
|
||||||
"""
|
|
||||||
if user != "root":
|
|
||||||
print("\nslpkg: Error: Must have root privileges\n")
|
|
||||||
raise SystemExit()
|
|
||||||
|
|
||||||
def build_FAILED(self, prgnam):
|
def build_FAILED(self, prgnam):
|
||||||
"""Print error message if build failed
|
"""Print error message if build failed
|
||||||
"""
|
"""
|
||||||
|
|
33
slpkg/superuser.py
Normal file
33
slpkg/superuser.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# superuser.py file is part of slpkg.
|
||||||
|
|
||||||
|
# Copyright 2014-2015 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
|
||||||
|
# Slpkg is a user-friendly package manager for Slackware installations
|
||||||
|
|
||||||
|
# https://github.com/dslackw/slpkg
|
||||||
|
|
||||||
|
# Slpkg is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import getpass
|
||||||
|
|
||||||
|
|
||||||
|
def s_user():
|
||||||
|
"""Check for root user
|
||||||
|
"""
|
||||||
|
if getpass.getuser() != "root":
|
||||||
|
print("\nslpkg: Error: Must have root privileges\n")
|
||||||
|
raise SystemExit()
|
Loading…
Reference in a new issue