summaryrefslogtreecommitdiff
path: root/src/util.py
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-01-18 23:59:00 +0000
committerdavidovski <david@davidovski.xyz>2022-01-18 23:59:00 +0000
commitd8c1c620465785b42747a6796b9a872578742e37 (patch)
treebab0eb9f40c8d944fee08cd43147495e779e4e5b /src/util.py
parent7ba337c6805b1571e3212f37fa9545bd813fa361 (diff)
added stats command
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