refs #2688 receive new parameter "gen-script" in Configurar
parent
a6cacacdb5
commit
9cbd6e8dfe
|
@ -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
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue