summaryrefslogtreecommitdiffstats
path: root/src/utils/fs.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2022-05-09 09:52:26 +0200
committerJose M. Guisado <jguisado@soleta.eu>2022-05-09 12:57:36 +0200
commit4e5b17ce6dcafa2818114c49fcff71af5afcdd26 (patch)
tree94ebba6031805761232c05342ee23e8d21e602dd /src/utils/fs.py
parenta3cf8d150a5b0450548a967c5dea40b7fb020d4f (diff)
probe: detect 64 bit operating systems
OpenGnsys partition images store OS information, including the OS name appended with "64 bits" when the OS is meant for 64 bit machines. The detected OS name when probing (refresh) is important, if it differs from what's stored in the DB OpenGnsys will wipe last image restored information when running a refresh. See actualizaConfiguracion from legacy ogserver (ogAdmServer.c) code: dato = dbi_result_get_uint(result, "idnombreso"); if (idsoi == dato) { swu = false; } ... if (swu) { result_update = dbi_conn_queryf(dbi->conn, "UPDATE ordenadores_particiones SET " " codpar=0x%s," " tamano=%s," " uso=%s," " idsistemafichero=%d," " idnombreso=%d," " idimagen=0," " idperfilsoft=0," " fechadespliegue=NULL" " WHERE idordenador=%d AND numdisk=%s AND numpar=%s",
Diffstat (limited to 'src/utils/fs.py')
-rw-r--r--src/utils/fs.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py
index 43011ef..7500ebd 100644
--- a/src/utils/fs.py
+++ b/src/utils/fs.py
@@ -14,6 +14,16 @@ from subprocess import DEVNULL
import psutil
+def find_mountpoint(path):
+ """
+ Returns mountpoint of a given path
+ """
+ path = os.path.abspath(path)
+ while not os.path.ismount(path):
+ path = os.path.dirname(path)
+ return path
+
+
def mount_mkdir(source, target):
"""
Mounts and creates the mountpoint directory if it's not present.