summaryrefslogtreecommitdiff
path: root/src/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.py')
-rw-r--r--src/util.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/util.py b/src/util.py
index 647f211..5ce93a9 100644
--- a/src/util.py
+++ b/src/util.py
@@ -1,4 +1,5 @@
import shutil
+import csv
import requests
import colors
import time
@@ -129,7 +130,23 @@ def ask_confirmation(text, default=True, no_confirm=False):
return reponse.lower() == "y" or len(reponse) == 0
-if __name__ == "__main__":
- for i in range(1000):
- loading_bar(i, 1000, "it is loading...")
- time.sleep(0.01)
+def get_distro():
+
+ RELEASE_DATA = {}
+
+ with open("/etc/os-release") as f:
+ reader = csv.reader(f, delimiter="=")
+ for row in reader:
+ if row:
+ RELEASE_DATA[row[0]] = row[1]
+
+ if RELEASE_DATA["ID"] in ["debian", "raspbian"]:
+ with open("/etc/debian_version") as f:
+ DEBIAN_VERSION = f.readline().strip()
+ major_version = DEBIAN_VERSION.split(".")[0]
+ version_split = RELEASE_DATA["VERSION"].split(" ", maxsplit=1)
+ if version_split[0] == major_version:
+ # Just major version shown, replace it with the full version
+ RELEASE_DATA["VERSION"] = " ".join([DEBIAN_VERSION] + version_split[1:])
+
+ return RELEASE_DATA