From 9cbd6e8dfe01c31c673b8365ebb79ee2f6411e6c Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Thu, 28 Aug 2025 12:51:34 +0200 Subject: [PATCH] refs #2688 receive new parameter "gen-script" in Configurar --- CHANGELOG.md | 6 +++++ ogclient/interfaceAdm/Configurar | 45 +++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48343ab..5289e8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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.3.0] - 2025-08-28 + +### Changed + +- Receive new parameter "gen-script" in Configurar + ## [1.2.0] - 2025-08-26 ### Removed diff --git a/ogclient/interfaceAdm/Configurar b/ogclient/interfaceAdm/Configurar index ace03df..dc93c6f 100755 --- a/ogclient/interfaceAdm/Configurar +++ b/ogclient/interfaceAdm/Configurar @@ -20,10 +20,13 @@ SystemLib.ogEcho (['log', 'session'], None, f'{ogGlobals.lang.MSG_INTERFACE_STAR prog = os.path.basename(__name__) +#ignored = sys.argv[1] param = sys.argv[2] +script_out = sys.argv[3] check_sizes = False -if len (sys.argv) >= 4: - check_sizes = 'true' == sys.argv[3] +gen_script = False +if len (sys.argv) >= 5: check_sizes = 'true' == sys.argv[4] +if len (sys.argv) >= 6: gen_script = 'true' == sys.argv[5] # Leer los dos bloques de parámetros, separados por '!'. tbprm = param.split ('!') @@ -204,13 +207,46 @@ if sum_tam_sectors > space_left_by_cache: if check_sizes: sys.exit (0) +if gen_script: + fd = open (script_out, 'w') + + fd.write ('#!/usr/bin/python3\n') + fd.write ('\n') + fd.write ('from CacheLib import ogUnmountCache\n') + fd.write ('from FileSystemLib import ogUnmountAll\n') + fd.write ('from DiskLib import ogDeletePartitionTable, ogCreatePartitionTable\n') + fd.write ('\n') + fd.write (f'FileSystemLib.ogUnmountAll ({dis})\n') + fd.write ('CacheLib.ogUnmountCache()\n') + + if recreate_partition_table: + fd.write (f'DiskLib.ogDeletePartitionTable ({dis})\n') + fd.write (f'DiskLib.ogCreatePartitionTable ({dis}, {ptt})\n') + + if is_there_cache: + fd.write (f'initCache {dis} {tch}\n') + + if tbp: + fd.write (f'ogCreatePartitions {dis} {' '.join (tbp)}\n') + + if tbf: + for p in range (1, maxp+1): + if p not in tbf: continue + if 'CACHE' == tbf[p]: + CACHESIZE = CacheLib.ogGetCacheSize() + if CACHESIZE == tch: + fd.write ('ogFormatCache\n') + else: + fd.write (f'ogFormatFs {dis} {p} {tbf[p]}\n') + + fd.close() + sys.exit (0) + #____________________________________________________ # # Proceso #____________________________________________________ -# Tamaño actual de la cache -CACHESIZE=CacheLib.ogGetCacheSize() # Desmonta todas las particiones y la caché @@ -249,6 +285,7 @@ if tbf: for p in range (1, maxp+1): if p not in tbf: continue if 'CACHE' == tbf[p]: + CACHESIZE = CacheLib.ogGetCacheSize() if CACHESIZE == tch: # Si el tamaño es distinto ya se ha formateado. SystemLib.ogEcho (['session', 'log'], None, ' ogFormatCache') retval = SystemLib.ogExecAndLog ('command', [f'{ogGlobals.OGPYFUNCS}/ogFormatCache'])