mirror of
https://github.com/Derisis13/barusu.git
synced 2025-12-07 03:52:48 +01:00
Script checks for root if run in restore mode. This might help with using it correctly
This commit is contained in:
3
main.py
3
main.py
@@ -32,6 +32,7 @@ def save_settings():
|
|||||||
|
|
||||||
def restore():
|
def restore():
|
||||||
global packagelist, config
|
global packagelist, config
|
||||||
|
if os.getuid() == 0:
|
||||||
try:
|
try:
|
||||||
os.chdir(backupdir)
|
os.chdir(backupdir)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@@ -49,6 +50,8 @@ def restore():
|
|||||||
subprocess.call(["dpkg", "--set-selections"], stdin=packagelist)
|
subprocess.call(["dpkg", "--set-selections"], stdin=packagelist)
|
||||||
subprocess.call(["apt-get", "dselect-upgrade"])
|
subprocess.call(["apt-get", "dselect-upgrade"])
|
||||||
packagelist.close()
|
packagelist.close()
|
||||||
|
else:
|
||||||
|
print("You're not root! You can't restore packages unless you are root!")
|
||||||
try:
|
try:
|
||||||
config = open("dconf_out.txt", "r")
|
config = open("dconf_out.txt", "r")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|||||||
Reference in New Issue
Block a user