Compare commits

..

12 Commits

Author SHA1 Message Date
Natalia Serrano 5e7b60366f Merge pull request 'refs #2348 don't copy grub.cfg' (#76) from dont-copy-grub-cfg into main
ogclient/pipeline/head This commit looks good Details
ogclient/pipeline/tag This commit looks good Details
Reviewed-on: #76
2025-06-27 13:28:15 +02:00
Natalia Serrano a142bb2729 refs #2348 don't copy grub.cfg 2025-06-27 13:27:52 +02:00
Natalia Serrano aa5efb52a3 Merge pull request 'refs #2343 don't check call to updateBootCache' (#75) from update-boot-cache into main
ogclient/pipeline/head This commit looks good Details
ogclient/pipeline/tag This commit looks good Details
Reviewed-on: #75
2025-06-27 11:31:36 +02:00
Natalia Serrano a64968d57f refs #2343 don't check call to updateBootCache 2025-06-27 11:31:09 +02:00
Nicolas Arenas 84c7aa8e29 Merge branch 'update_torrent_clients'
ogclient/pipeline/head This commit looks good Details
2025-06-27 08:10:43 +02:00
Nicolas Arenas 2a92557bbc Updated Changelog 2025-06-27 08:07:33 +02:00
Nicolas Arenas b410403ea5 missing changes in last commit 2025-06-27 08:03:43 +02:00
Nicolas Arenas 5ea6489b41 missing changes in last commit 2025-06-27 07:46:16 +02:00
Nicolas Arenas 155f4b95b8 Merge pull request 'refs #2340: Replaces ctorrent with aria2c and mktorrent' (#73) from update_torrent_clients into main
ogclient/pipeline/head This commit looks good Details
Reviewed-on: #73
2025-06-27 07:02:53 +02:00
Nicolas Arenas 4ae16782ca updated changelog 2025-06-27 06:53:51 +02:00
Nicolas Arenas 5321325142 refs #2340: Replaces ctorrent with aria2c and mktorrent 2025-06-26 18:44:31 +02:00
Natalia Serrano 4c191aa730 Merge pull request 'fix-syntax-and-others' (#72) from fix-syntax-and-others into main
ogclient/pipeline/head This commit looks good Details
ogclient/pipeline/tag This commit looks good Details
Reviewed-on: #72
2025-06-26 13:39:31 +02:00
3 changed files with 89 additions and 40 deletions

View File

@ -5,6 +5,31 @@ 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).
## [0.22.3] - 2025-06-27
### Changed
- Don't copy grub.cfg
## [0.22.2] - 2025-06-27
### Fixed
- Don't check rc of updateBootCache.py because we may have no cache partition
## [0.22.1] - 2025-06-27
### Fixed
- Included some changes that should be in the previous version
## [0.22.0] - 2025-06-26
### Changed
- Changed torrent client from ctorrent to aria2c
- Updated ogCreateTorrent function replaced ctorrent with mktorrent
## [0.21.1] - 2025-06-26
### Fixed

View File

@ -126,14 +126,6 @@ def ogBoot (disk, par, nvramperm=False, params=''):
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'{esp} Boot loader')
return None
esp_dev = DiskLib.ogDiskToDev (efidisk, efipart)
esp_mntdir = esp_dev.replace ('dev', 'mnt')
os.makedirs (f'{esp_mntdir}/boot/grub', exist_ok=True)
grub_cfg_src = f'{esp_mntdir}/EFI/{bootlabel}/Boot/grub.cfg'
if not os.path.exists (grub_cfg_src):
grub_cfg_src = f'{esp_mntdir}/boot/grubMBR/boot/grub/grub.cfg'
shutil.copy2 (grub_cfg_src, f'{esp_mntdir}/boot/grub/grub.cfg')
# Crear orden de arranque (con unos valores por defecto).
UEFILib.ogNvramAddEntry (bootlabel, f'/EFI/{bootlabel}/Boot/{bootloader}', nvramperm)
# Marcar próximo arranque y reiniciar.
@ -164,14 +156,6 @@ def ogBoot (disk, par, nvramperm=False, params=''):
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTOS, f'{disk} {par} ({type}, EFI)')
return None
esp_dev = DiskLib.ogDiskToDev (efidisk, efipart)
esp_mntdir = esp_dev.replace ('dev', 'mnt')
os.makedirs (f'{esp_mntdir}/boot/grub', exist_ok=True)
grub_cfg_src = f'{esp_mntdir}/EFI/{bootlabel}/Boot/grub.cfg'
if not os.path.exists (grub_cfg_src):
grub_cfg_src = f'{esp_mntdir}/boot/grubMBR/boot/grub/grub.cfg'
shutil.copy2 (grub_cfg_src, f'{esp_mntdir}/boot/grub/grub.cfg')
# Crear orden de arranque (con unos valores por defecto).
l = re.sub ('^.*EFI(.*)$', r'\1', loader)
UEFILib.ogNvramAddEntry (bootlabel, '/EFI'+l, nvramperm)
@ -701,7 +685,7 @@ def ogGrubInstallMbr (disk, par, checkos='FALSE', kernelparam=''):
prefixsecondstage = '' # Reactivamos el grub con el grub.cfg original.
else: # SI Reconfigurar segunda etapa (grub.cfg) == TRUE
#llamada a updateBootCache para que aloje la primera fase del ogLive
subprocess.run ([f'{ogGlobals.OGSCRIPTS}/updateBootCache.py'], check=True)
subprocess.run ([f'{ogGlobals.OGSCRIPTS}/updateBootCache.py'])
if InventoryLib.ogIsEfiActive():
# UEFI: grubSintax necesita grub.cfg para detectar los kernels: si no existe recupero backup.

View File

@ -671,7 +671,7 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or torrentfile {dev_err} not found')
return
if subprocess.run (['ctorrent', '-x', source]).returncode: ## if True, then ctorrent failed
if subprocess.run (['aria2c', '-S', source]).returncode: ## if True, then aria2c failed
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, '')
return None
@ -697,24 +697,36 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre
OPTION = None
cwd = os.getcwd()
# si No fichero .bf, y Si fichero destino imagen ya descargada y su chequeo fue comprobado en su descarga inicial.
if not os.path.exists (f'{source}.bf') and os.path.exists (target):
# si No fichero .aria2, y Si fichero destino imagen ya descargada y su chequeo fue comprobado en su descarga inicial.
if not os.path.exists (f'{target}.aria2') and os.path.exists (target):
print ('imagen ya descargada')
if 'seeder' != mode: return 'success' ## return any true value
print ('MODE seeder ctorrent')
print ('MODE seeder aria2c')
os.chdir (dirsource)
subprocess.run (['timeout', '--signal', 'INT', time, 'ctorrent', '-f', source])
aria2_cmd = [
"aria2c",
"--check-integrity=true",
"--bt-seed-unverified=true",
"--disable-ipv6",
"--seed-ratio=0.0",
f"--seed-time={time}",
"--enable-dht=false",
"--enable-peer-exchange=false",
f"--dir={dirsource}",
f"{source}"
]
subprocess.run (aria2_cmd)
os.chdir (cwd)
return 'success'
#Si no existe bf ni fichero destino descarga inicial.
if not os.path.exists (f'{source}.bf') and not os.path.exists (target):
#Si no existe bf ni fichero destino descarga inicial.
if not os.path.exists (f'{target}.aria2') and not os.path.exists (target):
print ('descarga inicial')
OPTION = 'DOWNLOAD'
# Si fichero bf descarga anterior no completada -.
if os.path.exists (f'{source}.bf') and os.path.exists (target):
if os.path.exists (f'{target}.aria2') and os.path.exists (target):
print ('Continuar con Descargar inicial no terminada.')
OPTION = 'DOWNLOAD'
@ -723,25 +735,51 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre
os.chdir (dirsource)
if 'peer' == mode:
print ('Donwloading Torrent as peer')
# Creamos el fichero de resumen por defecto
open (f'{source}.bf', 'w').close()
# ctorrent controla otro fichero -b ${SOURCE}.bfog
ctorrent_cmd = ['ctorrent', '-f', '-c', '-X', f'sleep {time}; kill -2 $(pidof ctorrent)', '-C', '100', source, '-s', target, '-b', f'{source}.bfog']
SystemLib.ogEcho(["session","log"],"warning",f'Starting PeerTorrent download in PEER mode')
aria2_cmd = [
"aria2c",
"--enable-dht=false",
"--enable-peer-exchange=false",
"--disable-ipv6" ,
f"--seed-time={time}",
f"--dir={dirsource}",
f"{source}"
]
elif 'leecher' == mode:
print ('Donwloading Torrent as leecher')
ctorrent_cmd = ['ctorrent', source, '-X', 'sleep 30; kill -2 $(pidof ctorrent)', '-C', '100', '-U', '0']
SystemLib.ogEcho(["session","log"],"warning",f'Starting PeerTorrent download in LEECHER mode')
aria2_cmd = [
"aria2c",
"--enable-dht=false",
"--enable-peer-exchange=false",
"--disable-ipv6" ,
"--seed-time=0",
f"--dir={dirsource}",
f"{source}"
]
elif 'seeder' == mode:
print ('MODE seeder ctorrent')
# Creamos el fichero de resumen por defecto
open (f'{source}.bf', 'w').close()
# ctorrent controla otro fichero -b ${SOURCE}.bfog
ctorrent_cmd = ['ctorrent', '-f', '-c', '-X', f'sleep {time}; kill -2 $(pidof ctorrent)', '-C', '100', source, '-s', target, '-b', f'{source}.bfog']
print ('MODE seeder aria2c')
SystemLib.ogEcho(["session","log"],"warning",f'Starting PeerTorrent download in SEEDER mode')
aria2_cmd = [
"aria2c",
"--check-integrity=true",
"--bt-seed-unverified=true",
"--disable-ipv6" ,
"--seed-ratio=0.0",
f"--seed-time={time}",
"--enable-dht=false",
"--enable-peer-exchange=false",
f"--dir={dirsource}", f"{source}"
]
else:
print ('this should not happen')
return None
print (f'executing ctorrent: {' '.join(ctorrent_cmd)}')
subprocess.run (ctorrent_cmd)
SystemLib.ogEcho(["session","log"],"warning",f'Launching torrent command: {aria2_cmd}')
subprocess.run (aria2_cmd)
os.chdir (cwd)
@ -811,11 +849,13 @@ def ogCreateTorrent (disk=None, par=None, container=None, file=None, ip_bttrack=
cwd = os.getcwd()
os.chdir (os.path.dirname (source))
print (f'ctorrent -t {os.path.basename (source)} -u http://{ip_bttrack}:6969/announce -s {source}.torrent')
subprocess.run (['ctorrent', '-t', os.path.basename (source), '-u', f'http://{ip_bttrack}:6969/announce', '-s', f'{source}.torrent'])
print (f'mktorrent -a http://{ip_bttrack}:6969/announce -o {source}.torrent {source}')
subprocess.run (['mktorrent' , '-a', f'http://{ip_bttrack}:6969/announce', '-o', f'{source}.torrent', source])
os.chdir (cwd)
#/**
# ogUpdateCacheIsNecesary [ str_repo ] Relative_path_file_OGIMG_with_/
#@brief Comprueba que el fichero que se desea almacenar en la cache del cliente, no esta.