refs #2862 parches ugr
parent
58856aa41d
commit
b4bf8d363a
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.7.6] - 2025-10-16
|
||||
|
||||
### Fixed
|
||||
|
||||
- getConfiguration: leave filesystems as there were (wrt mounted/unmounted)
|
||||
- BootLib: refactor calls to spartlnx
|
||||
- FileSystemLib: make ogUnmountFs return False upon failure
|
||||
- GitLib: log less stuff yet again
|
||||
- ogGlobals: don't pollute the PATH
|
||||
- add some missing shebangs
|
||||
|
||||
## [1.7.5] - 2025-10-16
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -6,7 +6,7 @@ import subprocess
|
|||
|
||||
from InventoryLib import ogGetSerialNumber, ogGetOsVersion, ogIsEfiActive
|
||||
from DiskLib import ogDiskToDev, ogGetPartitionsNumber, ogGetPartitionTableType, ogGetDiskSize, ogGetPartitionId, ogGetPartitionSize
|
||||
from FileSystemLib import ogMount, ogGetMountPoint, ogGetFsType
|
||||
from FileSystemLib import ogMount, ogGetMountPoint, ogGetFsType, ogIsMounted, ogUnmount
|
||||
|
||||
ser = ogGetSerialNumber()
|
||||
fwt = 'UEFI' if ogIsEfiActive() else 'BIOS'
|
||||
|
@ -47,6 +47,7 @@ if disks:
|
|||
soi = ''
|
||||
uso = '0'
|
||||
if fsi not in ['', 'EMPTY', 'LINUX-SWAP', 'LINUX-LVM', 'ZVOL']:
|
||||
is_mounted = ogIsMounted (dsk, par)
|
||||
if ogMount (dsk, par):
|
||||
soi = ogGetOsVersion (dsk, par)
|
||||
# Hacer un 2º intento para algunos casos especiales.
|
||||
|
@ -60,6 +61,7 @@ if disks:
|
|||
mntpt = ogGetMountPoint (dsk, par)
|
||||
uso = subprocess.run (['df', mntpt], capture_output=True, text=True).stdout.splitlines()[-1].split()[4].replace ('%', '')
|
||||
if not uso: uso = '0'
|
||||
if not is_mounted: ogUnmount (dsk, par)
|
||||
else:
|
||||
soi = ''
|
||||
uso = '0'
|
||||
|
|
|
@ -22,6 +22,16 @@ import FileLib
|
|||
import UEFILib
|
||||
import CacheLib
|
||||
|
||||
|
||||
def _spartlnx (f):
|
||||
fd = open (f, 'r')
|
||||
contents = fd.read()
|
||||
fd.close()
|
||||
SystemLib.ogEcho (['log', 'session'], None, f'spartlnx file ({f}) contents ({contents})')
|
||||
p = subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', f], stdin=subprocess.DEVNULL, capture_output=True, text=True)
|
||||
SystemLib.ogEcho (['log', 'session'], None, f'spartlnx rc ({p.returncode}) stdout ({p.stdout}) stderr ({p.stderr})')
|
||||
|
||||
|
||||
## ogBoot int_ndisk int_nfilesys [ NVRAMPERM ] [str_kernel str_initrd str_krnlparams]
|
||||
#@brief Inicia el proceso de arranque de un sistema de archivos.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
|
@ -396,8 +406,7 @@ def ogFixBootSector (disk, par):
|
|||
main_part={par}
|
||||
fix_first_sector=yes
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
|
||||
_spartlnx (tmpfile)
|
||||
os.remove (tmpfile)
|
||||
|
||||
|
||||
|
@ -480,8 +489,7 @@ disk={disk0}
|
|||
main_part={par}
|
||||
boot_entry=Windows Resume Application
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
#Preparando instruccion tipo windows
|
||||
with open (tmpfile, 'w') as fd:
|
||||
|
@ -492,7 +500,7 @@ disk={disk0}
|
|||
main_part={par}
|
||||
boot_entry={winver}
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
##Preparando instruccion Ramdisk Options
|
||||
with open (tmpfile, 'w') as fd:
|
||||
|
@ -503,7 +511,7 @@ disk={disk0}
|
|||
main_part={par}
|
||||
boot_entry=Ramdisk Options
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
##Preparando instruccion Recovery Environment
|
||||
with open (tmpfile, 'w') as fd:
|
||||
|
@ -514,7 +522,7 @@ disk={disk0}
|
|||
main_part={par}
|
||||
boot_entry=Windows Recovery Environment
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
##Preparando instruccion Recovery
|
||||
with open (tmpfile, 'w') as fd:
|
||||
|
@ -525,7 +533,7 @@ disk={disk0}
|
|||
main_part={par}
|
||||
boot_entry=Windows Recovery
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
#Preparando instruccion Windows Boot Manager
|
||||
with open (tmpfile, 'w') as fd:
|
||||
|
@ -536,7 +544,7 @@ disk={bootdisk}
|
|||
main_part={bootpar}
|
||||
boot_entry=Windows Boot Manager
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
#Preparando instruccion Herramienta de diagnóstico de memoria de Windows
|
||||
with open (tmpfile, 'w') as fd:
|
||||
|
@ -547,7 +555,7 @@ disk={bootdisk}
|
|||
main_part={bootpar}
|
||||
boot_entry=Herramienta de diagnóstico de memoria de Windows
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
#Preparando instruccion Herramienta de diagnóstico de memoria de Windows
|
||||
with open (tmpfile, 'w') as fd:
|
||||
|
@ -558,7 +566,7 @@ disk={bootdisk}
|
|||
main_part={bootpar}
|
||||
boot_entry=Herramienta de diagn<f3>stico de memoria de Windows
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
os.remove (tmpfile)
|
||||
|
||||
|
@ -614,7 +622,7 @@ main_part={registered_par}
|
|||
;ext_part
|
||||
part_letter={registered_vol}
|
||||
""")
|
||||
subprocess.run (['timeout', '--foreground', '--signal=SIGKILL', '5s', 'spartlnx.run', '-cui', '-nm', '-w', '-f', tmpfile], stdin=subprocess.DEVNULL)
|
||||
_spartlnx (tmpfile)
|
||||
|
||||
os.remove (tmpfile)
|
||||
|
||||
|
|
|
@ -737,6 +737,7 @@ def ogUnmountFs(disk, par):
|
|||
subprocess.run(["umount", PART], check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
SystemLib.ogEcho ([], "warning", f'ogUnmountFs: {ogGlobals.lang.MSG_DONTUNMOUNT}: "{disk}, {par}"')
|
||||
return False
|
||||
try:
|
||||
os.rmdir(MNTDIR)
|
||||
except:
|
||||
|
|
|
@ -106,7 +106,8 @@ class OgProgressPrinterWeb(git.RemoteProgress):
|
|||
self.simple_progress = stage_portion * self._get_stage_number(op_code) + (stage_portion * cur_count/max_count)
|
||||
|
||||
op_text, _ = _git_op_to_string(op_code)
|
||||
self.logger.debug(f"Progress: {op_text} ({op_code}) {cur_count}/{max_count}: {message}")
|
||||
if 0 == cur_count % 3: ## reduce logging
|
||||
self.logger.debug(f"Progress: {op_text} ({op_code}) {cur_count}/{max_count}: {message}")
|
||||
self._send_progress (self.simple_progress)
|
||||
self.last_ts = now
|
||||
|
||||
|
@ -153,7 +154,8 @@ class OgProgressPrinterConsole(git.RemoteProgress):
|
|||
|
||||
op_text, op_unit = _git_op_to_string(op)
|
||||
|
||||
self.logger.debug(f"Progress: {op_text} ({op_code}) {cur_count}/{max_count}: {message}")
|
||||
if 0 == cur_count % 3: ## reduce logging
|
||||
self.logger.debug(f"Progress: {op_text} ({op_code}) {cur_count}/{max_count}: {message}")
|
||||
|
||||
if max_count is None:
|
||||
return
|
||||
|
|
|
@ -64,8 +64,19 @@ OGCAC = os.path.join (OPENGNSYS, 'cache')
|
|||
OGLOGFILE = '/var/log/clone-engine.log'
|
||||
OGJSONLOGFILE = '/var/log/clone-engine.json.log'
|
||||
DEBUG = 'yes'
|
||||
_path = os.environ['PATH'] + ':/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/opt/oglive/rootfs/opt/drbl/sbin'
|
||||
os.environ['PATH'] = ':'.join ([OGSCRIPTS, _path, OGAPI, OGBIN])
|
||||
|
||||
def _append2path (d):
|
||||
curpath = os.environ['PATH'].split (':')
|
||||
if d in curpath: return
|
||||
os.environ['PATH'] = ':'.join (curpath + [d])
|
||||
|
||||
def _prepend2path (d):
|
||||
curpath = os.environ['PATH'].split (':')
|
||||
if d in curpath: return
|
||||
os.environ['PATH'] = ':'.join ([d] + curpath)
|
||||
|
||||
for d in [OGSCRIPTS, OGPYFUNCS]: _prepend2path (d)
|
||||
for d in ['/sbin', '/usr/sbin', '/usr/local/sbin', '/bin', '/usr/bin', '/usr/local/bin', '/opt/oglive/rootfs/opt/drbl/sbin', OGAPI, OGBIN]: _append2path (d)
|
||||
|
||||
if os.path.exists ('/tmp/initrd.cfg'):
|
||||
with open ('/tmp/initrd.cfg', 'r') as fd:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import FileSystemLib
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import InventoryLib
|
||||
|
||||
|
|
Loading…
Reference in New Issue