diff --git a/CHANGELOG.md b/CHANGELOG.md index c45ab03..627dccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,158 +1,12 @@ -# Changelog +# Changelog -All notable changes to this project will be documented in this file. +## [0.1.1] - 2025-02-28 -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.8.0] - 2025-04-23 - -### Added - -- Have the oglive agent send /stopped on poweroff or restart - -## [0.7.2] - 2025-04-21 - -### Fixed - -- Have the partitioning functions return a meaningful rc - -## [0.7.1] - 2025-04-15 - -### Fixed - -- getConfiguration.py: don't fail if NTFS filesystems are mounted ro - -## [0.7.0] - 2025-04-15 - -### Removed - -- Removed references to ogGlobals.OGLOG in python code - -## [0.6.1] - 2025-04-15 - -### Fixed - -- Fixed capturing of partclone output and management of return value - -## [0.6.0] - 2025-04-15 - -### Changed - -- ogGetIpAddress() is no longer required in ogGlobals--move it back into NetLib - -## [0.5.0] - 2025-04-15 - -### Changed - -- Log to /var/log/clone-engine.log and clone-engine.json.log - -## [0.4.1] - 2025-04-10 - -### Fixed - -- restoreImage.py: return negated rc to the shell - -## [0.4.0] - 2025-04-10 - -### Changed - -- Make /opt/opengnsys writable in clients, just like it used to be - -## [0.3.6] - 2025-04-09 - -### Fixed - -- Fixed ogReduceFs - -## [0.3.5] - 2025-04-09 - -### Fixed - -- Fixed syntax - -## [0.3.4] - 2025-04-09 - -### Fixed - -- Fixed usage of ogEcho in FileSystemLib - -## [0.3.3] - 2025-04-09 - -### Fixed - -- Kill coproc'ed browser in all execution branches in Configurar.py - -## [0.3.2] - 2025-04-07 - -### Fixed - -- Handle invalid number of arguments pass to functions/ogCopyFile - -## [0.3.1] - 2025-04-03 - -### Fixed - -- Fixed invocation to ogCheckIpAddress in interfaceAdm/CrearImagen.py - -## [0.3.0] - 2025-04-03 - -### Removed - -- Removed burg and rsync 3.1 - -## [0.2.6] - 2025-03-31 - -### Fixed - -- Restore qt4 browser - -## [0.2.5] - 2025-03-31 - -### Fixed - -- Don't require protoopts in interfaceAdm/RestaurarImagen.py - -## [0.2.4] - 2025-03-28 - -### Removed - -- Removed burg, QT4 stuff, rsync 3.1 and the old browser - -## [0.2.3] - 2025-03-28 - -### Fixed - -- Fixed some errors in Configurar.py, ogCreateCache, ogCreatePartitions and initCache.py - -## [0.2.2] - 2025-03-26 - -### Fixed - -- Prevent EjecutarScript.py from capturing the output of the script - -## [0.2.1] - 2025-03-26 - -### Fixed - -- Run scripts with bash to avoid errno 8 "Exec format error" - -## [0.2.0] - 2025-03-25 - -### Added - -- getConfiguration.py now collects the firmware type -- Configurar.py now creates partition tables of the right type (MSDOS/GPT) for each machine - -## [0.1.1] - 2025-03-19 - -### Added - -- Missing functions in BootLib -- Some interfaceAdm python scripts +### Changed - 2025-03-19 ## [0.1.0] - 2025-02-28 -### Added +### Addded - Merge pull request 'Include all client files, build debian package' (#2) from deb-package into main + diff --git a/Jenkins/Jenkinsfile-deb-pkg b/Jenkins/Jenkinsfile-deb-pkg index 157ae91..9d69e8f 100644 --- a/Jenkins/Jenkinsfile-deb-pkg +++ b/Jenkins/Jenkinsfile-deb-pkg @@ -19,7 +19,7 @@ pipeline { stage('Prepare Workspace') { steps { script { - env.BUILD_DIR = "${WORKSPACE}/ogclient" + env.BUILD_DIR = "${WORKSPACE}/oggui" sh "mkdir -p ${env.BUILD_DIR}" } } @@ -48,22 +48,16 @@ pipeline { } } } - stage('Generate Changelog (Nightly)'){ - when { - branch 'main' - } - steps { - script { - def devName = params.DEV_NAME ? params.DEV_NAME : env.DEFAULT_DEV_NAME - def devEmail = params.DEV_EMAIL ? params.DEV_EMAIL : env.DEFAULT_DEV_EMAIL - generateDebianChangelog(env.BUILD_DIR, devName, devEmail,"nightly") - } - } - } + stage('Build') { steps { - script { - construirPaquete(env.BUILD_DIR, "../artifacts", "172.17.8.68", "/var/tmp/opengnsys/debian-repo/ogclient") + dir("${env.BUILD_DIR}") { + sh ''' + dpkg-buildpackage -us -uc + mkdir -p ../artifacts && mv ../*.deb ../*.changes ../*.buildinfo ../artifacts/ + ssh aptly@172.17.8.68 "rm -rf /var/tmp/opengnsys/debian-repo/ogclient && mkdir -p /var/tmp/opengnsys/debian-repo/ogclient" + scp -r ../artifacts/* aptly@172.17.8.68:/var/tmp/opengnsys/debian-repo/ogclient + ''' } } } @@ -75,24 +69,7 @@ pipeline { } agent { label 'debian-repo' } steps { - script { - // Construir el patrón de versión esperado en el nombre del paquete - def versionPattern = "${env.TAG_NAME}-${env.BUILD_NUMBER}" - publicarEnAptly('/var/tmp/opengnsys/debian-repo/ogclient', 'opengnsys-devel', versionPattern) - } - } - } - stage ('Publish to Debian Repository (Nightly)') { - when { - branch 'main' - } - agent { label 'debian-repo' } - steps { - script { - // Construir el patrón de versión esperado en el nombre del paquete - def versionPattern = "-${env.BUILD_NUMBER}~nightly" - publicarEnAptly('/var/tmp/opengnsys/debian-repo/ogclient', 'nightly', versionPattern) - } + sh "aptly repo add opengnsys-devel /var/tmp/opengnsys/debian-repo/ogclient/*.deb" } } } diff --git a/debian/ogclient.postinst b/debian/ogclient.postinst index fd0d089..e99fef5 100644 --- a/debian/ogclient.postinst +++ b/debian/ogclient.postinst @@ -23,7 +23,13 @@ case "$1" in cp -a "$OLD_FILE" "$NEW_FILE" # Append our configuration - echo "include = /etc/samba/smb-ogclient.conf" >> "$OLD_FILE" + echo "include = /etc/samba/smb-ogclient.conf" >> "$NEW_FILE" + + # Use ucf to handle the file update + ucf --debconf-ok "$NEW_FILE" "$OLD_FILE" + + # Clean up + rm -f "$NEW_FILE" # Reload Samba if command -v systemctl >/dev/null 2>&1; then @@ -42,8 +48,6 @@ case "$1" in ;; esac -chown -R opengnsys:opengnsys /opt/opengnsys/ogclient -chown -R opengnsys:opengnsys /opt/opengnsys/ogclient_log #DEBHELPER# exit 0 diff --git a/debian/ogclient.preinst b/debian/ogclient.preinst deleted file mode 100644 index 0761132..0000000 --- a/debian/ogclient.preinst +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -# Asegurarse de que el usuario exista -USER="opengnsys" -HOME_DIR="/opt/opengnsys" -if id "$USER" &>/dev/null; then - echo "El usuario $USER ya existe." -else - echo "Creando el usuario $USER con home en $HOME_DIR." - useradd -m -d "$HOME_DIR" -s /bin/bash "$USER" -fi - -exit 0 diff --git a/etc/samba/smb-ogclient.conf b/etc/samba/smb-ogclient.conf index 34d5496..a7c3422 100644 --- a/etc/samba/smb-ogclient.conf +++ b/etc/samba/smb-ogclient.conf @@ -1,7 +1,7 @@ [ogclient] comment = OpenGnsys Client browseable = no - writeable = yes + writeable = no locking = no path = /opt/opengnsys/ogclient guest ok = no diff --git a/ogclient/bin/rsync-31 b/ogclient/bin/rsync-31 new file mode 100755 index 0000000..366204f Binary files /dev/null and b/ogclient/bin/rsync-31 differ diff --git a/ogclient/functions/ogCopyFile b/ogclient/functions/ogCopyFile index f65663b..04f1784 100755 --- a/ogclient/functions/ogCopyFile +++ b/ogclient/functions/ogCopyFile @@ -55,9 +55,6 @@ elif 6 == len (sys.argv): args = parser.parse_args() src = { 'container': args.src_container, 'file': args.src_file } dst = { 'disk': args.dst_disk, 'par': args.dst_par, 'file': args.dst_file } -else: - ogHelp ('ogCopyFile', 'ogCopyFile [ str_repo | int_ndisk int_npartition ] path_source [ str_repo | int_ndisk int_npartition ] path_target', ['ogCopyFile REPO newfile.txt 1 2 /tmp/newfile.txt']) - sys.exit (1) ret = ogCopyFile (src, dst) if ret is not None: diff --git a/ogclient/interfaceAdm/Apagar.py b/ogclient/interfaceAdm/Apagar.py index b89c3cc..25545f3 100755 --- a/ogclient/interfaceAdm/Apagar.py +++ b/ogclient/interfaceAdm/Apagar.py @@ -2,9 +2,6 @@ import os import sys -import time -os.system ('pkill -f OGAgent') -time.sleep (3) os.system ('poweroff') sys.exit (0) diff --git a/ogclient/interfaceAdm/Configurar.py b/ogclient/interfaceAdm/Configurar.py index ab74291..d355c49 100755 --- a/ogclient/interfaceAdm/Configurar.py +++ b/ogclient/interfaceAdm/Configurar.py @@ -9,7 +9,6 @@ import SystemLib import CacheLib import FileSystemLib import DiskLib -import InventoryLib #Load engine configurator from engine.cfg file. #Carga el configurador del engine desde el fichero engine.cfg @@ -62,24 +61,23 @@ sparam = tbprm[1] # Partitioning and formatting parameters # Toma valores de disco y caché, separados por "*". # Los valores están en las variables $dis: disco, $che: existe cache (1, 0), $tch: Tamaño de la cache. tbprm = pparam.split ('*') -dis = tch = None +dis = ptt = tch = None for item in tbprm: if '=' not in item: continue k, v = item.split ('=', 1) - if k not in ['dis', 'tch']: + if k not in ['dis', 'tch', 'ptt']: ## 'ptt' added, unused 'che' removed print (f'ignoring unknown disk parameter ({k})') continue if 'dis' == k: dis = int (v) + elif 'ptt' == k: ptt = v elif 'tch' == k: tch = v # Error si no se define el parámetro de disco (dis). -if dis is None: - coproc.kill() - sys.exit (ogGlobals.OG_ERR_FORMAT) -if tch is None: - tch = '0' +if dis is None: sys.exit (ogGlobals.OG_ERR_FORMAT) +if ptt is None: ptt = 'MSDOS' +if tch is None: tch = '0' # Toma valores de distribución de particiones, separados por "%". tbp = [] # Valores de configuración (parámetros para ogCreatePartitions) @@ -114,7 +112,6 @@ for item in tbprm: if tam is None: missing_params.append ('tam') if missing_params: print (f'partition data ({item}) missing required parameters ({' '.join (missing_params)})') - coproc.kill() sys.exit (1) # Componer datos de particionado. @@ -141,21 +138,18 @@ CacheLib.ogUnmountCache() # Elimina la tabla de particiones cur_ptt = DiskLib.ogGetPartitionTableType (dis) -ptt = 'GPT' if InventoryLib.ogIsEfiActive() else 'MSDOS' if not cur_ptt or ptt != cur_ptt: DiskLib.ogDeletePartitionTable (dis) SystemLib.ogExecAndLog ('command', DiskLib.ogUpdatePartitionTable) + + # Crea tabla de particiones MSDOS (NOTA: adaptar para tablas GPT). DiskLib.ogCreatePartitionTable (dis, ptt) # Inicia la cache. if 'CACHE' in sparam: SystemLib.ogEcho (['session', 'log'], None, f'[30] {ogGlobals.lang.MSG_HELP_ogCreateCache}') SystemLib.ogEcho (['session', 'log'], None, f' initCache {tch}') - rc = SystemLib.ogExecAndLog ('command', CacheLib.initCache, tch) - if rc: - SystemLib.ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_CACHE, f'initCache failed') - coproc.kill() - sys.exit (1) + SystemLib.ogExecAndLog ('command', CacheLib.initCache, tch) # Definir particionado. SystemLib.ogEcho (['session', 'log'], None, f'[50] {ogGlobals.lang.MSG_HELP_ogCreatePartitions}') diff --git a/ogclient/interfaceAdm/CrearImagen.py b/ogclient/interfaceAdm/CrearImagen.py index 2ab2b58..ea2b096 100755 --- a/ogclient/interfaceAdm/CrearImagen.py +++ b/ogclient/interfaceAdm/CrearImagen.py @@ -66,7 +66,7 @@ repo = arg_repo if not repo: repo = 'REPO' if repo == ogGetIpAddress(): repo = 'CACHE' # Si es una ip y es distinta a la del recurso samba cambiamos de REPO. -if 'REPO' == repo or ogCheckIpAddress (repo): +if 'REPO' == repo or StringLib.ogCheckIpAddress (repo): # Si falla el cambio -> salimos con error repositorio no valido if not ogChangeRepo (repo): ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, repo) diff --git a/ogclient/interfaceAdm/EjecutarScript.py b/ogclient/interfaceAdm/EjecutarScript.py index 23bbbc3..d7b415c 100755 --- a/ogclient/interfaceAdm/EjecutarScript.py +++ b/ogclient/interfaceAdm/EjecutarScript.py @@ -34,7 +34,7 @@ with open (ogGlobals.OGLOGFILE, 'a') as logfd: os.chmod (script_path, 0o755) # Si mandamos la salida a OGLOGCOMMAND reescribimos lo que manda el comando. -RETVAL = subprocess.run (['bash', script_path]).returncode +RETVAL = subprocess.run (script_path, capture_output=True, text=True).returncode TIME = time.time() - TIME1 diff --git a/ogclient/interfaceAdm/Reiniciar.py b/ogclient/interfaceAdm/Reiniciar.py index ceaa589..0cbeedc 100755 --- a/ogclient/interfaceAdm/Reiniciar.py +++ b/ogclient/interfaceAdm/Reiniciar.py @@ -2,9 +2,6 @@ import os import sys -import time -os.system ('pkill -f OGAgent') -time.sleep (3) os.system ('reboot') sys.exit (0) diff --git a/ogclient/interfaceAdm/RestaurarImagen.py b/ogclient/interfaceAdm/RestaurarImagen.py index 4b5c4b8..efde3af 100755 --- a/ogclient/interfaceAdm/RestaurarImagen.py +++ b/ogclient/interfaceAdm/RestaurarImagen.py @@ -19,11 +19,11 @@ import ogGlobals if __name__ == '__main__': prog = sys.argv[0] - if len (sys.argv) < 6: - print (f'Usage: {prog} [protocol_options] [additional_args...]') + if len (sys.argv) < 7: + print (f'Usage: {prog} [additional_args...]') sys.exit (1) - disk, par, imgname, repo, proto, *extra = sys.argv[1:] + disk, par, imgname, repo, proto, protoopt, *extra = sys.argv[1:] - rc = subprocess.run ([f'{ogGlobals.OGSCRIPTS}/deployImage.py', repo, imgname, disk, par, proto] + extra).returncode + rc = subprocess.run ([f'{ogGlobals.OGSCRIPTS}/deployImage.py', repo, imgname, disk, par, proto, protoopt] + extra).returncode sys.exit (rc) diff --git a/ogclient/interfaceAdm/getConfiguration.py b/ogclient/interfaceAdm/getConfiguration.py index 29d4ec4..89a1b0a 100755 --- a/ogclient/interfaceAdm/getConfiguration.py +++ b/ogclient/interfaceAdm/getConfiguration.py @@ -1,78 +1,80 @@ -#!/usr/bin/python3 - +#!/usr/bin/env python3 import os -import glob import subprocess -from InventoryLib import ogGetSerialNumber, ogGetOsVersion, ogIsEfiActive -from DiskLib import ogDiskToDev, ogGetPartitionsNumber, ogGetPartitionTableType, ogGetDiskSize, ogGetPartitionId, ogGetPartitionSize -from FileSystemLib import ogMount, ogGetMountPoint, ogGetFsType +def run_command(command): + result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + return result.stdout.decode().strip() -ser = ogGetSerialNumber() -fwt = 'UEFI' if ogIsEfiActive() else 'BIOS' -print (f'ser={ser}\nfwt={fwt}') +def main(): + # No registrar los errores. + os.environ["DEBUG"] = "no" + + ser = run_command("ogGetSerialNumber") + cfg = "" + disks = int(run_command("ogDiskToDev | wc -w")) + + for dsk in range(1, disks + 1): + particiones = run_command(f"ogGetPartitionsNumber {dsk}") + particiones = int(particiones) if particiones else 0 + ptt = run_command(f"ogGetPartitionTableType {dsk}") -disks = len (ogDiskToDev()) -if disks: - for dsk in range (1, disks+1): - # Tipo de tabla de particiones: 1=MSDOS, 2=GPT - ptt = ogGetPartitionTableType (dsk) ptt_map = { - 'MSDOS': 1, - 'GPT': 2, - 'LVM': 3, - 'ZPOOL': 4, + "MSDOS": 1, + "GPT": 2, + "LVM": 3, + "ZPOOL": 4 } - ptt = ptt_map.get (ptt, 0) + ptt = ptt_map.get(ptt, 0) - # Información de disco (partición 0) - s = ogGetDiskSize (dsk) - print (f'disk={dsk}\tpar=0\tcpt={ptt}\tfsi=\tsoi=\ttam={s}\tuso=0') + cfg += f"{dsk}:0:{ptt}:::{run_command(f'ogGetDiskSize {dsk}')}:0;" - particiones = ogGetPartitionsNumber (dsk) - particiones = int (particiones) if particiones else 0 - for par in range (1, particiones+1): - # Código del identificador de tipo de partición - cod = ogGetPartitionId (dsk, par) + for par in range(1, particiones + 1): + cod = run_command(f"ogGetPartitionId {dsk} {par} 2>/dev/null") + fsi = run_command(f"getFsType {dsk} {par} 2>/dev/null") or "EMPTY" + tam = run_command(f"ogGetPartitionSize {dsk} {par} 2>/dev/null") or "0" + soi = "" + uso = 0 - # Tipo del sistema de ficheros - fsi = ogGetFsType (dsk, par) - if not fsi: fsi = 'EMPTY' - - # Tamaño de la particón - tam = ogGetPartitionSize (dsk, par) - if not tam: tam = '0' - - # Sistema operativo instalado y porcentaje de uso - soi = '' - uso = '0' - if fsi not in ['', 'EMPTY', 'LINUX-SWAP', 'LINUX-LVM', 'ZVOL']: - if ogMount (dsk, par): - soi = ogGetOsVersion (dsk, par) - # Hacer un 2º intento para algunos casos especiales. + if fsi not in ["", "EMPTY", "LINUX-SWAP", "LINUX-LVM", "ZVOL"]: + if run_command(f"ogMount {dsk} {par} 2>/dev/null"): + soi = run_command(f"getOsVersion {dsk} {par} 2>/dev/null").split(":")[1] if not soi: - soi = ogGetOsVersion (dsk, par) - if not soi: soi = '' - if soi: soi = soi.split (':')[1] - # Sistema de archivos para datos (sistema operativo "DATA") - if not soi and fsi not in ['EMPTY', 'CACHE']: - soi = 'DATA' - 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' + soi = run_command(f"getOsVersion {dsk} {par} 2>/dev/null").split(":")[1] + if not soi and fsi not in ["EMPTY", "CACHE"]: + soi = "DATA" + uso = int(run_command(f"df $(ogGetMountPoint {dsk} {par}) | awk '{{getline; printf \"%d\",$5}}'") or 0) else: - soi = '' - uso = '0' + soi = "" + uso = 0 - print (f'disk={dsk}\tpar={par}\tcpt={cod}\tfsi={fsi}\tsoi={soi}\ttam={tam}\tuso={uso}') -else: - print ('disk=1\tpar=0\tcpt=0\tfsi=\tsoi=\ttam=0\tuso=0') + cfg += f"{dsk}:{par}:{cod}:{fsi}:{soi}:{tam}:{uso};" -# Crear el menú por defecto a partir del fichero generado (no dar ninguna salida). -# requiere /tmp/getconfig pero este script ya no lo crea -#subprocess.run ([f'{ogGlobals.OGSCRIPTS}/generateMenuDefault']) + if not cfg: + cfg = "1:0:0:::0;" -# Borramos marcas de arranque de Windows -for f in glob.glob ('/mnt/*/ogboot.*') + glob.glob ('/mnt/*/*/ogboot.*'): - try: os.unlink (f) - except: pass + cfgfile = "/tmp/getconfig" + with open(cfgfile, "w") as f: + f.write(f"{ser + ';' if ser else ''}{cfg}") + + run_command("generateMenuDefault &>/dev/null") + + with open(cfgfile, "r") as f: + data = f.read() + + lines = data.split(";") + for line in lines: + if line: + parts = line.split(":") + if len(parts) == 1: + print(f"ser={parts[0]}") + else: + print(f"disk={parts[0]}\tpar={parts[1]}\tcpt={parts[2]}\tfsi={parts[3]}\tsoi={parts[4]}\ttam={parts[5]}\tuso={parts[6]}") + + run_command("rm -f /mnt/*/ogboot.* /mnt/*/*/ogboot.*") + + # Volver a registrar los errores. + os.environ.pop("DEBUG", None) + +if __name__ == "__main__": + main() diff --git a/ogclient/interfaceAdm/getIpAddress.py b/ogclient/interfaceAdm/getIpAddress.py index 18d5150..0ba1389 100755 --- a/ogclient/interfaceAdm/getIpAddress.py +++ b/ogclient/interfaceAdm/getIpAddress.py @@ -1,5 +1,10 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 +import socket -from NetLib import ogGetIpAddress +def get_ip_address(): + hostname = socket.gethostname() + ip_address = socket.gethostbyname(hostname) + return ip_address -print (ogGetIpAddress()) +if __name__ == "__main__": + print(get_ip_address()) diff --git a/ogclient/lib/burg/themes/OpenGnsys/background-original.png b/ogclient/lib/burg/themes/OpenGnsys/background-original.png new file mode 100644 index 0000000..57861de Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/background-original.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/background.png b/ogclient/lib/burg/themes/OpenGnsys/background.png new file mode 100755 index 0000000..8150330 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/background.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/extended b/ogclient/lib/burg/themes/OpenGnsys/extended new file mode 100644 index 0000000..c61e14a --- /dev/null +++ b/ogclient/lib/burg/themes/OpenGnsys/extended @@ -0,0 +1,79 @@ +include "theme" + +screen { + background = "$$/background.png" + + panel { + halign = center + attach_vcenter = 0 + height = 19 + # Flip so the cursor defaults to the main menu + direction = bottom_to_top + + ### Main Menu ### + panel { + height = 15 + max_width = 120 + margin_top = 1 + class = container-body + # No need for a min width and centering panel because extended width > min width + + direction = left_to_right + anchor = 1 + id = __menu__ + } + + panel { + height = 4 + width = 100% + class = container-title + + direction = left_to_right + + image { + image = "$$/images/txt-select.png" + attach_top = 0 + attach_left = 0 + } + + ### Tools Menu ### + image { + attach_right = 2 + image = "$$/images/button-tools.png:$$/images/button-tools-hover.png" + command = "menu_popup tools_menu" + } + } + } + + ### Progress Bar ### + panel { + halign = center + attach_vcenter = 20 + width = 80 + class = progressbar-background + id = __timeout__ + + progressbar { } + } +} + +template_menuitem { + panel { + width = 40 + height = 12 + + parameters = "class=image.class:title=panel.text.text" + + image { + attach_vcenter = 0 + attach_hcenter = 0 + } + + panel { + attach_vcenter = 0 + attach_hcenter = 0 + class = text-line + text { font = "Helvetica Regular 22" } + } + } +} diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_debian.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_debian.png new file mode 100644 index 0000000..55d7ce0 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_debian.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_elementary.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_elementary.png new file mode 100644 index 0000000..a2bc2b2 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_elementary.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_freebsd.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_freebsd.png new file mode 100644 index 0000000..eedade7 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_freebsd.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_haiku.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_haiku.png new file mode 100644 index 0000000..f6b21d6 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_haiku.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_linux.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_linux.png new file mode 100644 index 0000000..5064c4a Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_linux.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_opengnsys.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_opengnsys.png new file mode 100644 index 0000000..aea9bfe Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_opengnsys.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_opensuse.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_opensuse.png new file mode 100644 index 0000000..bdc548b Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_opensuse.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_os.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_os.png new file mode 100644 index 0000000..abb4b29 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_os.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_osx.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_osx.png new file mode 100644 index 0000000..8a1c8f5 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_osx.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_recovery.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_recovery.png new file mode 100644 index 0000000..d9144a6 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_recovery.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_restart.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_restart.png new file mode 100644 index 0000000..9c30c23 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_restart.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_shutdown.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_shutdown.png new file mode 100644 index 0000000..39b123f Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_shutdown.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_ubuntu.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_ubuntu.png new file mode 100644 index 0000000..d1cda27 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_ubuntu.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows.png new file mode 100644 index 0000000..96e11c8 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows10.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows10.png new file mode 100644 index 0000000..0eabef7 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows10.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows7.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows7.png new file mode 100644 index 0000000..95d9e18 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows7.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows_metro.png b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows_metro.png new file mode 100644 index 0000000..7ace114 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/hover_windows_metro.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/icons b/ogclient/lib/burg/themes/OpenGnsys/icons/icons new file mode 100644 index 0000000..15d5bec --- /dev/null +++ b/ogclient/lib/burg/themes/OpenGnsys/icons/icons @@ -0,0 +1,21 @@ ++class +{ + -opengnsys { image = "$$/normal_opengnsys.png:$$/hover_opengnsys.png" } + -windows10 { image = "$$/normal_windows10.png:$$/hover_windows10.png" } + -windows7 { image = "$$/normal_windows7.png:$$/hover_windows7.png" } + -windows { image = "$$/normal_windows.png:$$/hover_windows.png" } + -elementary { image = "$$/normal_elementary.png:$$/hover_elementary.png" } + -elementaryos { image = "$$/normal_elementary.png:$$/hover_elementary.png" } + -recovery { image = "$$/normal_recovery.png:$$/hover_recovery.png" } + -shutdown { image = "$$/normal_shutdown.png:$$/hover_shutdown.png" } + -restart { image = "$$/normal_restart.png:$$/hover_restart.png" } + -linux { image = "$$/normal_linux.png:$$/hover_linux.png" } + -ubuntu { image = "$$/normal_ubuntu.png:$$/hover_ubuntu.png" } + -debian { image = "$$/normal_debian.png:$$/hover_debian.png" } + -suse { image = "$$/normal_opensuse.png:$$/hover_opensuse.png" } + -freebsd { image = "$$/normal_freebsd.png:$$/hover_freebsd.png" } + -macosx { image = "$$/normal_osx.png:$$/hover_osx.png" } + -haiku { image = "$$/normal_haiku.png:$$/hover_haiku.png" } + -image { image = "$$/normal_os.png:$$/hover_os.png" } + -os { image = "$$/normal_os.png:$$/hover_os.png" } +} diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_debian.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_debian.png new file mode 100644 index 0000000..88b19a3 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_debian.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_elementary.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_elementary.png new file mode 100644 index 0000000..31863ec Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_elementary.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_freebsd.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_freebsd.png new file mode 100644 index 0000000..1162e53 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_freebsd.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_haiku.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_haiku.png new file mode 100644 index 0000000..cab9bfd Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_haiku.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_linux.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_linux.png new file mode 100644 index 0000000..8e215df Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_linux.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_opengnsys.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_opengnsys.png new file mode 100644 index 0000000..687f180 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_opengnsys.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_opensuse.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_opensuse.png new file mode 100644 index 0000000..6ab2c37 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_opensuse.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_os.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_os.png new file mode 100644 index 0000000..7d33f4d Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_os.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_osx.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_osx.png new file mode 100644 index 0000000..5955b67 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_osx.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_recovery.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_recovery.png new file mode 100644 index 0000000..a1c6db3 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_recovery.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_restart.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_restart.png new file mode 100644 index 0000000..1f0e69f Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_restart.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_shutdown.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_shutdown.png new file mode 100644 index 0000000..2176660 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_shutdown.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_ubuntu.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_ubuntu.png new file mode 100644 index 0000000..becf779 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_ubuntu.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows.png new file mode 100644 index 0000000..9609364 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows10.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows10.png new file mode 100644 index 0000000..8caf5c7 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows10.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows7.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows7.png new file mode 100644 index 0000000..34d50eb Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows7.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows_metro.png b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows_metro.png new file mode 100644 index 0000000..8d4974e Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/icons/normal_windows_metro.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/000-70opaque.png b/ogclient/lib/burg/themes/OpenGnsys/images/000-70opaque.png new file mode 100644 index 0000000..8f92c2f Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/000-70opaque.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-bg.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-bg.png new file mode 100644 index 0000000..a3ee24e Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-bg.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-bg.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-bg.png new file mode 100644 index 0000000..cd88d06 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-bg.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-l.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-l.png new file mode 100644 index 0000000..1a9a516 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-l.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-r.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-r.png new file mode 100644 index 0000000..a8befbb Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-hover-r.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-l.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-l.png new file mode 100644 index 0000000..34b3bf0 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-l.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-r.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-r.png new file mode 100644 index 0000000..0cb01e8 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-r.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-tools-hover.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-tools-hover.png new file mode 100644 index 0000000..a8c74b1 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-tools-hover.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/button-tools.png b/ogclient/lib/burg/themes/OpenGnsys/images/button-tools.png new file mode 100644 index 0000000..1cef055 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/button-tools.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-b.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-b.png new file mode 100644 index 0000000..54b5999 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-b.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-bg.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-bg.png new file mode 100644 index 0000000..9d1a625 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-bg.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-bl.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-bl.png new file mode 100644 index 0000000..aaadeae Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-bl.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-br.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-br.png new file mode 100644 index 0000000..eb2fbcb Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-br.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-l.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-l.png new file mode 100644 index 0000000..d2bda89 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-l.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-r.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-r.png new file mode 100644 index 0000000..741e2ba Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-r.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-t.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-t.png new file mode 100644 index 0000000..2ab4a00 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-t.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-title-bg.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-bg.png new file mode 100644 index 0000000..e269395 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-bg.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-title-l.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-l.png new file mode 100644 index 0000000..eb80522 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-l.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-title-r.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-r.png new file mode 100644 index 0000000..4195892 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-r.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-title-t.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-t.png new file mode 100644 index 0000000..6c56bf8 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-t.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-title-tl.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-tl.png new file mode 100644 index 0000000..1d2ad5e Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-tl.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-title-tr.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-tr.png new file mode 100644 index 0000000..dbd43df Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-title-tr.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-tl.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-tl.png new file mode 100644 index 0000000..b12e704 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-tl.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/container-tr.png b/ogclient/lib/burg/themes/OpenGnsys/images/container-tr.png new file mode 100644 index 0000000..92ed266 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/container-tr.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-b.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-b.png new file mode 100644 index 0000000..7fdf4d3 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-b.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bg.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bg.png new file mode 100644 index 0000000..373414b Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bg.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bl.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bl.png new file mode 100644 index 0000000..1ef93ff Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bl.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bl.xcf b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bl.xcf new file mode 100644 index 0000000..e2b417d Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-bl.xcf differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-br.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-br.png new file mode 100644 index 0000000..b877839 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-br.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-lr.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-lr.png new file mode 100644 index 0000000..9ebb1ba Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-lr.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-spacer.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-spacer.png new file mode 100644 index 0000000..e96e664 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-spacer.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-t.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-t.png new file mode 100644 index 0000000..05720e6 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-t.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-tl.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-tl.png new file mode 100644 index 0000000..d9554e6 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-tl.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/dialog-tr.png b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-tr.png new file mode 100644 index 0000000..9d4123e Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/dialog-tr.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-b.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-b.png new file mode 100644 index 0000000..c8295bb Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-b.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-bl.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-bl.png new file mode 100644 index 0000000..1854229 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-bl.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-br.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-br.png new file mode 100644 index 0000000..ff8871c Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-br.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-l.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-l.png new file mode 100644 index 0000000..3a4fc40 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-l.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-r.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-r.png new file mode 100644 index 0000000..dadd4ac Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-r.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-t.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-t.png new file mode 100644 index 0000000..cd99485 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-t.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-tl.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-tl.png new file mode 100644 index 0000000..8341760 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-tl.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-tr.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-tr.png new file mode 100644 index 0000000..72a05f6 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg-tr.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg.png b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg.png new file mode 100644 index 0000000..92db1e0 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/progressbar-bg.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/text-line-l.png b/ogclient/lib/burg/themes/OpenGnsys/images/text-line-l.png new file mode 100644 index 0000000..ed1852c Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/text-line-l.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/text-line-r.png b/ogclient/lib/burg/themes/OpenGnsys/images/text-line-r.png new file mode 100644 index 0000000..5c9f49a Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/text-line-r.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/tick.png b/ogclient/lib/burg/themes/OpenGnsys/images/tick.png new file mode 100644 index 0000000..292ceb8 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/tick.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/txt-about.png b/ogclient/lib/burg/themes/OpenGnsys/images/txt-about.png new file mode 100644 index 0000000..f104c82 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/txt-about.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/txt-help.png b/ogclient/lib/burg/themes/OpenGnsys/images/txt-help.png new file mode 100644 index 0000000..6fad772 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/txt-help.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/txt-select.png b/ogclient/lib/burg/themes/OpenGnsys/images/txt-select.png new file mode 100644 index 0000000..d459597 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/txt-select.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/txt-tools.png b/ogclient/lib/burg/themes/OpenGnsys/images/txt-tools.png new file mode 100644 index 0000000..d8eadd7 Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/txt-tools.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/images/ubuntu-glow-96.png b/ogclient/lib/burg/themes/OpenGnsys/images/ubuntu-glow-96.png new file mode 100644 index 0000000..b8fd92c Binary files /dev/null and b/ogclient/lib/burg/themes/OpenGnsys/images/ubuntu-glow-96.png differ diff --git a/ogclient/lib/burg/themes/OpenGnsys/menus b/ogclient/lib/burg/themes/OpenGnsys/menus new file mode 100644 index 0000000..f9a13fd --- /dev/null +++ b/ogclient/lib/burg/themes/OpenGnsys/menus @@ -0,0 +1,188 @@ +tools_menu { + panel { + class = overlay + + panel { + attach_hcenter = 0 + attach_vcenter = 0 + width = 30 + + panel { + class = dialog-title + image { image = "$$/images/txt-tools.png" attach_left = 0 } + } + + panel { + class = dialog-body + + text { class = br } + + text { + text = "Toggle Mode" + command = "menu_toggle_mode" + class = text-menu-item + } + text { + text="Terminal" + command = "menu_popup term_window" + class = text-menu-item + } + text { + text = "Restart" + command = reboot + class = text-menu-item + } + text { + text = "Shutdown" + command = halt + class = text-menu-item + } + text { + text = "Help" + command = "menu_popup help" + class = text-menu-item + } + text { + text = "About" + command = "menu_popup about" + class = text-menu-item + } + } + } + } +} + +about { + panel { + class = overlay + + panel { + attach_hcenter = 0 + attach_vcenter = 0 + margin_left = 2 + width = 60 + + panel { + class = dialog-title + image { image = "$$/images/txt-about.png" attach_left = 0 } + } + + panel { + class = dialog-body + + text { class = br } + text { text = "Darkness" class = "dialog-text" } + text { class = br } + text { text = "Designed & Created by LuxieRayku(luksi.reiku@gmail.com)" class = "dialog-text" } + text { text = "Darkness theme is designed to feel clean," class = "dialog-text" } + text { text = "light, modern & minimal." class = dialog-text } + text { class = br } + + panel { + halign = center + class = button + command = true + + text { text = OK class = button-text } + } + } + } + } +} + +help { + panel { + class = overlay + + panel { + attach_hcenter = 0 + attach_vcenter = 0 + margin_left = 2 + width = 48 + + panel { + class = dialog-title + image { image = "$$/images/txt-help.png" attach_left = 0 } + } + + panel { + class = dialog-body + + text { text = "F1/h - Help" class = dialog-text } + text { text = "F2/t - Change theme" class = dialog-text } + text { text = "F3/r - Change resolution" class = dialog-text } + text { text = "F5/ctrl-x - Finish edit" class = dialog-text } + text { text = "F6 - Next window" class = dialog-text } + text { text = "F7 - Show folded items" class = dialog-text } + text { text = "F8 - Toggle between text and graphic mode" class = dialog-text } + text { text = "F9 - Shutdown" class = dialog-text } + text { text = "F10 - Reboot" class = dialog-text } + text { text = "f - Toggle between folded and unfolded mode" class = dialog-text } + text { text = "c - Open terminal" class = dialog-text } + text { text = "2 - Open two terminals" class = dialog-text } + text { text = "e - Edit current command" class = dialog-text } + text { text = "q - Quit graphic mode" class = dialog-text } + text { text = "i - Show theme information" class = dialog-text } + text { text = "n - Next item with the same class" class = dialog-text } + text { text = "w - Next windows item" class = dialog-text } + text { text = "u - Next ubuntu item" class = dialog-text } + text { text = "ESC - Exit from window or menu" class = dialog-text } + + panel { + halign = center + class = button + command = true + + text { text = OK class = button-text } + } + } + } + } +} + +term_window { + panel { + class = terminal + width = 100% + height = 100% + term { + width=100% + height=100% + } + } +} + +two_term { + panel { + width = 100% + height = 100% + direction = left_to_right + + panel { + class = terminal + extend = 1 + + term { + width=100% + height=100% + } + } + + panel { + class = terminal + extend = 1 + + term { + width=100% + height=100% + } + } + } +} +/*menu { + Shutdown { + class = "shutdown" + group = "group_main" + command = "halt" + } +}*/ diff --git a/ogclient/lib/burg/themes/OpenGnsys/style b/ogclient/lib/burg/themes/OpenGnsys/style new file mode 100644 index 0000000..325e503 --- /dev/null +++ b/ogclient/lib/burg/themes/OpenGnsys/style @@ -0,0 +1,158 @@ ++class { + ### Default Elements ### + screen { + background = "#250040" + } + + text { + color = "#4d0085:#ffffff" + font = "Sans Bold 16" + } + + progressbar { + width = 80% + height = 4/1 + color = "#ffffff:#4d0085" + } + + edit { + color = "white" + } + + password { + color = "white" + } + + term { + color = "white" + } + + ### Text Styles ### + br { + text = "- " + font = "Sans Bold 16" + } + + text-menu-item { + color = "white" + font = "Sans Bold 16" + } + + dialog-title-text { + halign = center + color = "black" + } + + dialog-text { + color = "white" + font = "Sans Bold 16" + } + + button-text { + font = "Sans Bold 16" + color = "white" + } + + ### Panel Styles ### + text-line { + left = ",,,#0x0020:$$/images/text-line-l.png" + background = ",,,#0x0020:$$/images/dialog-bg.png" + right = ",,,#0x0020:$$/images/text-line-r.png" + } + + button { + left = "$$/images/button-l.png:$$/images/button-hover-l.png" + background = "$$/images/button-bg.png:$$/images/button-hover-bg.png" + right = "$$/images/button-r.png:$$/images/button-hover-r.png" + margin_left = 2 + margin_right = 2 + margin_top = 3/0 + margin_bottom = 3/0 + } + + terminal { + top_left = ",,light-gray/black,#0x2554:,,white/black,#0x250F" + top = ",,light-gray/black,#0x2550:,tiling,white/black,#0x2501" + top_right = ",,light-gray/black,#0x2557:,,white/black,#0x2513" + left = ",,light-gray/black,#0x2551:,tiling,white/black,#0x2503" + background="$$/images/000-70opaque.png" + right = ",,light-gray/black,#0x2551:,tiling,white/black,#0x2503" + bottom_left = ",,light-gray/black,#0x255A:,,white/black,#0x2517" + bottom = ",,light-gray/black,#0x2550:,tiling,white/black,#0x2501" + bottom_right = ",,light-gray/black,#0x255D:,tiling,white/black,#0x251B" + } + + progressbar-background { + top_left = "$$/images/progressbar-bg-tl.png" + top = "$$/images/progressbar-bg-t.png" + top_right = "$$/images/progressbar-bg-tr.png" + left = "$$/images/progressbar-bg-l.png" + background = "$$/images/progressbar-bg.png" + right = "$$/images/progressbar-bg-r.png" + bottom_left = "$$/images/progressbar-bg-bl.png" + bottom = "$$/images/progressbar-bg-b.png" + bottom_right = "$$/images/progressbar-bg-br.png" + } + + + dialog { + top_left = "$$/images/dialog-tl.png" + top = "$$/images/dialog-t.png" + top_right = "$$/images/dialog-tr.png" + left = "$$/images/dialog-lr.png" + background = "$$/images/dialog-bg.png" + right = "$$/images/dialog-lr.png" + bottom_left = "$$/images/dialog-bl.png" + bottom = "$$/images/dialog-b.png" + bottom_right = "$$/images/dialog-br.png" + } + + dialog-title { + top_left = "$$/images/dialog-tl.png" + top = "$$/images/dialog-t.png" + top_right = "$$/images/dialog-tr.png" + left = "$$/images/dialog-lr.png" + background = "$$/images/dialog-bg.png" + right = "$$/images/dialog-lr.png" + bottom_left = "$$/images/dialog-spacer.png" + bottom = "$$/images/dialog-spacer.png" + bottom_right = "$$/images/dialog-spacer.png" + } + + dialog-body { + left = "$$/images/dialog-lr.png" + background = "$$/images/dialog-bg.png" + right = "$$/images/dialog-lr.png" + bottom_left = "$$/images/dialog-bl.png" + bottom = "$$/images/dialog-b.png" + bottom_right = "$$/images/dialog-br.png" + } + +# container-title { +# top_left = "$$/images/container-title-tl.png" +# top = "$$/images/container-title-t.png" +# top_right = "$$/images/container-title-tr.png" +# left = "$$/images/container-title-l.png" +# background = "$$/images/container-title-bg.png" +# right = "$$/images/container-title-r.png" +# } + + container-body { + top_left = "$$/images/container-tl.png" + top = "$$/images/container-t.png" + top_right = "$$/images/container-tr.png" + left = "$$/images/container-l.png" + background = "$$/images/container-bg.png" + right = "$$/images/container-r.png" + bottom_left = "$$/images/container-bl.png" + bottom = "$$/images/container-b.png" + bottom_right = "$$/images/container-br.png" + } + + overlay { + height = 100% + width = 100% + absolute = 1 + background="$$/images/000-70opaque.png" + } +} diff --git a/ogclient/lib/burg/themes/OpenGnsys/theme b/ogclient/lib/burg/themes/OpenGnsys/theme new file mode 100644 index 0000000..4307c18 --- /dev/null +++ b/ogclient/lib/burg/themes/OpenGnsys/theme @@ -0,0 +1,231 @@ +include "menus" +include "../icons/hover" +include "icons/icons" +include "style" + +screen { + background = "$$/background.png" + + panel { + halign = center + attach_vcenter = 0 + height = 19 + # Flip so the cursor defaults to the main menu + direction = bottom_to_top + + ### Main Menu ### + panel { + min_width = 36 + class = container-body + height = 14 +# margin_top = 0 + max_width = 128 + + panel { + halign = center + + space = 0 + direction = left_to_right + anchor = 1 + id = __menu__ + popup = bottom + } + } + + panel { + halign = center + height = 4 + min_width = 36 + class = container-title + + space = 0 + direction = left_to_right + anchor = 1 + + image { + halign=center + image = "$$/images/txt-select.png" + attach_top = 2 + attach_left = 2 + } + + ### Tools Menu ### +# image { +# attach_right = 2 +# image = "$$/images/button-tools.png:$$/images/button-tools-hover.png" +# command = "menu_popup tools_menu" +# } + } + } + + ### Progress Bar ### + panel { + halign = center + attach_bottom = 4 + width = 60 + class = progressbar-background + id = __timeout__ + + progressbar { } + } +} + +template_menuitem { + panel { + width = 20 + height = 10 + + parameters = "class=image.class:title=panel.text.text" + + ### Icon ### + image { + attach_vcenter = 0 + attach_hcenter = 0 + } + + ### Text ### +# panel { +# attach_vcenter = 0 +# attach_hcenter = 0 +# margin_left = 1 +# margin_right = 1 +# class = text-line +# text {} +# } + } +} + +template_submenu { + panel { + class = dialog + } +} + +template_subitem { + panel { + parameters = "title=text.text" + text {} + } +} + +template_popup { + panel { + attach_hcenter = 0 + attach_vcenter = 0 + class = dialog + } +} + +dialog_line { + panel { + parameters = "text=edit.text" + class = dialog + width = 60 + attach_hcenter = 0 + attach_vcenter = 0 + + edit { + lines = 1 + max_lines = 1 + } + } +} + +dialog_edit { + panel { + parameters = "text=edit.text" + class = dialog + width = 90 + attach_hcenter = 0 + attach_vcenter = 0 + + edit { + lines = 10 + } + } +} + +dialog_message { + panel { + parameters = "text=text.text" + class = dialog + margin_size = 1 + margin_bottom = 0 + space = 1 + attach_hcenter = 0 + attach_vcenter = 0 + text {} + panel { + class = button + command = true + halign = center + text { text = OK class = button-text } + } + } +} + +dialog_password { + panel { + parameters = "username=__user__.text:password=__pass__.text" + class = dialog + margin_size = 1 + margin_bottom = 0 + attach_hcenter = 0 + attach_vcenter = 0 + + panel { + direction = left_to_right + space = 1 + text { + extend = 1 + valign = center + text = Username + } + + panel { + margin_left = 1 + margin_right = 1 + edit { + id = __user__ + max_lines = 1 + } + } + } + + panel { + direction = left_to_right + space = 1 + text { + extend = 1 + valign = center + text = Password + } + panel { + margin_left = 1 + margin_right = 1 + password { + id = __pass__ + } + } + } + + panel { + class = button + command = true + halign = center + margin_left = 1 + margin_right = 1 + text { + text = OK + class = button-text + } + } + } +} +menu { + +# Shutdown { +# command = "halt" +# class = "shutdown" +# } +} diff --git a/ogclient/lib/python3/BootLib.py b/ogclient/lib/python3/BootLib.py index 5224539..7bf91b6 100644 --- a/ogclient/lib/python3/BootLib.py +++ b/ogclient/lib/python3/BootLib.py @@ -1387,6 +1387,7 @@ def ogGrubSecurity (disk, par, user='root', passwd=''): for _cuatro in ['menu.lst', 'grub.cfg', 'grub.cfg.backup.og']: path = '/'.join ([secondstage, _uno, _dos, _tres, _cuatro]) grubcfg += glob.glob (path) + print (f'nati grubcfg ({grubcfg})') # comprobamos que exista el archivo de configuración. if not grubcfg: diff --git a/ogclient/lib/python3/CacheLib.py b/ogclient/lib/python3/CacheLib.py index 2918526..bb4a3ce 100644 --- a/ogclient/lib/python3/CacheLib.py +++ b/ogclient/lib/python3/CacheLib.py @@ -60,9 +60,11 @@ def ogCreateCache (ndsk=1, part=4, sizecache=0): prev_part = part - i if prev_part <= 0: break ENDPREVPART = DiskLib.ogGetLastSector (ndsk, prev_part) + print (f'nati got endprevpart ({ENDPREVPART})') if ENDPREVPART: break i += 1 if not ENDPREVPART: + print (f'nati no endprevpart, assuming 0') ENDPREVPART=0 #SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, ndsk) #return None @@ -70,6 +72,7 @@ def ogCreateCache (ndsk=1, part=4, sizecache=0): MINSIZE = 25000 MAXSIZE = END if SIZE < MINSIZE or SIZE > MAXSIZE or START < ENDPREVPART: + print (f'nati size ({SIZE}) < minsize ({MINSIZE}) or size > maxsize ({MAXSIZE}) or start ({START}) < endprevpart ({ENDPREVPART})') SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, ndsk) return None @@ -79,20 +82,23 @@ def ogCreateCache (ndsk=1, part=4, sizecache=0): # En el caso de ser disco GPT, de momento se borra la particion y se vuelve a crear, # por lo que se pierden los datos. pttype = DiskLib.ogGetPartitionTableType (ndsk) + print (f'nati pttype ({pttype})') if not pttype: pttype = 'MSDOS' DiskLib.ogCreatePartitionTable (ndsk, pttype) get_ptt = DiskLib.ogGetPartitionTableType (ndsk) + print (f'nati get_ptt ({get_ptt})') if 'GPT' == get_ptt: # Si la tabla de particiones no es valida, volver a generarla. - if subprocess.run (['sgdisk', '-p', DISK], capture_output=True, text=True).returncode: - subprocess.run (['gdisk', DISK], input='2\nw\nY\n', capture_output=True, text=True) + if subprocess.run (['sgdisk', '-p', DISK]).returncode: + subprocess.run (['gdisk', DISK], input='2\nw\nY\n', text=True) # Si existe la cache se borra previamente if ogFindCache(): ogDeleteCache() # Capturamos el codigo de particion GPT para cache # PATCH - Cuando es GPT, la particion con codigo CACHE (CA00) no existe y no puede crearse, se cambia por LINUX (8300) ID = DiskLib.ogTypeToId ('LINUX', 'GPT') + print (f'nati ID ({ID})') subprocess.run (['sgdisk', DISK, f'-n{part}:{START}:{END}', f'-c{part}:CACHE', f'-t{part}:{ID}']) elif 'MSDOS' == get_ptt: # Si la tabla de particiones no es valida, volver a generarla. @@ -100,6 +106,7 @@ def ogCreateCache (ndsk=1, part=4, sizecache=0): subprocess.run (['fdisk', DISK], input='w\n', text=True) # Definir particiones y notificar al kernel. ID = DiskLib.ogTypeToId ('CACHE', 'MSDOS') + print (f'nati ID ({ID})') # Salvamos la configuración de las particiones e incluimos la cache. tmp = subprocess.run (['sfdisk', '--dump', DISK], capture_output=True, text=True).stdout.splitlines() tmp = [ x for x in tmp if f'{DISK}{part}' not in x ] @@ -110,10 +117,10 @@ def ogCreateCache (ndsk=1, part=4, sizecache=0): tmp = [UNIT, ''] + tmp # Guardamos nueva configuración en el disco. i = '\n'.join(tmp) + print (f'nati i ({i})') subprocess.run (['sfdisk', '--no-reread', DISK], input=i, text=True) # Actualiza la tabla de particiones en el kernel. DiskLib.ogUpdatePartitionTable() - return True diff --git a/ogclient/lib/python3/DiskLib.py b/ogclient/lib/python3/DiskLib.py index 1213358..5b95b05 100644 --- a/ogclient/lib/python3/DiskLib.py +++ b/ogclient/lib/python3/DiskLib.py @@ -76,7 +76,7 @@ def ogCreatePartitions (disk, parts): CACHEPART = CacheLib.ogFindCache() if CACHEPART: cache_disk, cache_part = CACHEPART.split() - if ND == int (cache_disk): + if ND == cache_disk: CACHESIZE = int (CacheLib.ogGetCacheSize()) * 2 # Sector de inicio (la partición 1 empieza en el sector 63). IODISCO = ogDiskToDev (disk) @@ -100,6 +100,7 @@ def ogCreatePartitions (disk, parts): SECTORS -= CACHESIZE PART = 1 + print (f'START ({START}) SECTORS ({SECTORS}) PART ({PART})') sfdisk_input = 'unit: sectors\n\n' NVME_PREFIX = 'p' if 'nvme' in DISK else '' @@ -108,7 +109,6 @@ def ogCreatePartitions (disk, parts): if f'{ND} {PART}' == CACHEPART and CACHESIZE: sfdisk_input += f'{DISK}{NVME_PREFIX}{PART} : start={SECTORS+1}, size={CACHESIZE}, Id=ca\n' PART += 1 - continue # Leer formato de cada parámetro - Tipo:Tamaño TYPE, SIZE = p.split (':') @@ -176,10 +176,12 @@ def ogCreatePartitions (disk, parts): ogCreatePartitionTable (ND) # Definir particiones y notificar al kernel. + #print (f'nati: about to run sfdisk: ({sfdisk_input})') p = subprocess.run (['sfdisk', DISK], input=sfdisk_input, capture_output=True, text=True) + #print (f'nati: rc ({p.returncode}) stdout ({p.stdout}) stderr ({p.stderr})') subprocess.run (['partprobe', DISK]) if CACHESIZE: CacheLib.ogMountCache() - return not p.returncode + return True #/** @@ -282,10 +284,12 @@ def ogCreateGptPartitions (disk, parts): ogCreatePartitionTable (ND, 'GPT') # Definir particiones y notificar al kernel. - p = subprocess.run (['sgdisk'] + DELOPTIONS + OPTIONS + [DISK], capture_output=True, text=True) + #print (f'nati: about to run sgdisk ({DELOPTIONS}) ({OPTIONS}) ({DISK})') + p = subprocess.run (['sgdisk'] + DELOPTIONS + OPTIONS + [DISK]) + #print (f'nati: rc ({p.returncode}) stdout ({p.stdout}) stderr ({p.stderr})') subprocess.run (['partprobe', DISK]) if CACHESIZE: CacheLib.ogMountCache() - return not p.returncode + return True #/** @@ -814,7 +818,7 @@ def ogGetPartitionId (disk, par): if fsid == '8300' and f'{disk} {par}' == CacheLib.ogFindCache(): fsid = 'CA00' elif 'MSDOS' == pttype: - fsid = subprocess.run (['sfdisk', '--part-type', DISK, str(par)], capture_output=True, text=True).stdout.strip() + fsid = subprocess.run (['sfdisk', '--part-type', DISK, par], capture_output=True, text=True).stdout.strip() elif 'LVM' == pttype: fsid = '10000' elif 'ZPOOL' == pttype: diff --git a/ogclient/lib/python3/FileLib.py b/ogclient/lib/python3/FileLib.py index 6bc0e05..2a4adf4 100644 --- a/ogclient/lib/python3/FileLib.py +++ b/ogclient/lib/python3/FileLib.py @@ -213,8 +213,10 @@ def ogCopyFile (src, dst): if not TARGET: SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dst_dev_err} not found') return + print (f'nati: ogCopyFile: SOURCE ({SOURCE}) TARGET ({TARGET})') # Copiar fichero (para evitar problemas de comunicaciones las copias se hacen con rsync en vez de cp). + print (f'nati: ogCopyFile: rsync --progress --inplace -avh ({SOURCE}) ({TARGET})') result = subprocess.run(["rsync", "--progress", "--inplace", "-avh", SOURCE, TARGET], capture_output=True, text=True) return result.returncode @@ -504,10 +506,12 @@ def ogMakeDir (container=None, disk=None, par=None, file=None): else: raise TypeError ('if one of "disk" and "par" are specified, then both must be') + print (f'nati: ogMakeDir: parent ({parent})') if not parent: SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dev_err} not found') return None dst = os.path.basename (file) + print (f'nati: ogMakeDir: dst ({dst})') os.makedirs (os.path.join (parent, dst), exist_ok=True) return True diff --git a/ogclient/lib/python3/FileSystemLib.py b/ogclient/lib/python3/FileSystemLib.py index 1067ddc..987ec7e 100644 --- a/ogclient/lib/python3/FileSystemLib.py +++ b/ogclient/lib/python3/FileSystemLib.py @@ -286,7 +286,11 @@ def ogGetFsSize (disk, par, unit='KB'): elif unit.upper() == "TB": factor = 1024 * 1024 * 1024 elif unit.upper() != "KB": - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f"{unit} != {{ KB, MB, GB, TB }}") + SystemLib.ogRaiseError ( + [], + ogGlobals.OG_ERR_FORMAT, + f"{unit} != {{ KB, MB, GB, TB }}" + ) return # Obtener el tamaño del sistema de archivo (si no está formateado; tamaño = 0). @@ -327,7 +331,11 @@ def ogGetFsType(disk, part): try: subprocess.run(["zfs", "mount", PART]) except FileNotFoundError: - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTEXEC, 'zfs') + SystemLib.ogRaiseError ( + [], + ogGlobals.OG_ERR_NOTEXEC, + 'zfs' + ) return out = subprocess.run(["mount"], capture_output=True, text=True).stdout.splitlines() for line in out: @@ -336,7 +344,11 @@ def ogGetFsType(disk, part): break if not TYPE: - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'{disk} {part}') + SystemLib.ogRaiseError ( + [], + ogGlobals.OG_ERR_NOTFOUND, + f'{disk} {part}' + ) return # Componer valores correctos. @@ -580,7 +592,11 @@ def ogMountFs (disk, par): try: rc = subprocess.run(['mount', dev, mntdir, '-o', 'force,remove_hiberfile'], check=True).returncode except subprocess.CalledProcessError: - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, f"{disk}, {par}") + SystemLib.ogRaiseError ( + [], + ogGlobals.OG_ERR_PARTITION, + f"{disk}, {par}" + ) return if 0 == rc: @@ -589,18 +605,26 @@ def ogMountFs (disk, par): try: subprocess.run (['ntfsfix', '-d', par], check=True) except subprocess.CalledProcessError: - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, f"{disk, par}") + SystemLib.ogRaiseError ( + [], + ogGlobals.OG_ERR_PARTITION, + f"{disk, par}" + ) #return else: try: subprocess.run (['mount', par, mntdir, '-o', 'ro'], check=True) except subprocess.CalledProcessError: - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, f"{disk, par}") + SystemLib.ogRaiseError ( + [], + ogGlobals.OG_ERR_PARTITION, + f"{disk, par}" + ) #return # Aviso de montaje de solo lectura. if ogIsReadonly(disk, par): - SystemLib.ogEcho ([], "warning", f'ogMountFs: {ogGlobals.lang.MSG_MOUNTREADONLY}: "{disk}, {par}"') + SystemLib.ogEcho("warning", f'ogMountFs: {ogGlobals.lang.MSG_MOUNTREADONLY}: "{disk}, {par}"') else: # Montar sistema de archivos ZFS (un ZPOOL no comienza por "/"). subprocess.run(['zfs', 'mount', dev]) @@ -692,8 +716,7 @@ def ogReduceFs (disk, par): break elif type == 'NTFS': ogUnmount (disk, par) - ntfsresize_out = subprocess.run (['ntfsresize', '-fi', PART], capture_output=True, text=True).stdout - nr_lines = ntfsresize_out.splitlines() + nr_lines = subprocess.run (['ntfsresize', '-fi', PART], capture_output=True, text=True).stdout.splitlines() maxsize = None size = None for l in nr_lines: @@ -703,10 +726,12 @@ def ogReduceFs (disk, par): size = l.split()[4] size = int ((int (size) * 1.1 / 1024 + 1) * 1024) - if not maxsize or not size: - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, f'{disk},{par} ({ntfsresize_out})') + if not maxsize and not size: + SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, f'{disk},{par}') return None + import time + extrasize = 0 retval = 1 while retval != 0 and size+extrasize < maxsize: @@ -784,14 +809,18 @@ def ogUnmountFs(disk, par): if MNTDIR: # Error si la particion está bloqueada. if ogIsLocked (disk, par): - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_LOCKED, f"{ogGlobals.lang.MSG_PARTITION}, {disk} {par}") + SystemLib.ogRaiseError ( + [], + ogGlobals.OG_ERR_LOCKED, + f"{ogGlobals.lang.MSG_PARTITION}, {disk} {par}" + ) return # Desmontar y borrar punto de montaje. try: subprocess.run(["umount", PART], check=True) except subprocess.CalledProcessError: - SystemLib.ogEcho ([], "warning", f'ogUnmountFs: {ogGlobals.lang.MSG_DONTUNMOUNT}: "{disk}, {par}"') + SystemLib.ogEcho("warning", f'ogUnmountFs: {ogGlobals.lang.MSG_DONTUNMOUNT}: "{disk}, {par}"') try: os.rmdir(MNTDIR) except: diff --git a/ogclient/lib/python3/ImageLib.py b/ogclient/lib/python3/ImageLib.py index 621924e..647b341 100644 --- a/ogclient/lib/python3/ImageLib.py +++ b/ogclient/lib/python3/ImageLib.py @@ -248,6 +248,7 @@ def ogCreateImage (disk, par, container, imgfile, tool='partclone', level='gzip' # Crear Imagen. #trap + print (f'nati program ({program})') p = subprocess.run (program, shell=True, check=True) errcode = p.returncode if 0 == errcode: @@ -511,10 +512,10 @@ def ogRestoreImage (repo, imgpath, disk, par): rc = None try: + #print (f'nati: ogRestoreImage: running ({program})') p = subprocess.run (program, shell=True, capture_output=True, text=True) - print (p.stdout) - print (p.stderr) rc = p.returncode + #print (f'nati: ogRestoreImage: rc ({rc}) stdout ({p.stdout}) stderr ({p.stderr})') if not rc: SystemLib.ogRaiseError ([], ogGlobalsOG_ERR_IMAGE, f'{imgfile}, {disk}, {par}') except: diff --git a/ogclient/lib/python3/NetLib.py b/ogclient/lib/python3/NetLib.py index 438d72d..5bd7cc5 100644 --- a/ogclient/lib/python3/NetLib.py +++ b/ogclient/lib/python3/NetLib.py @@ -199,6 +199,7 @@ def ogGetMacAddress(): mac_addresses.append(parts[i + 1].upper()) if mac_addresses: + print (f'nati: ogGetMacAddress: {mac_addresses[0]}') return mac_addresses[0] else: print("No active mac address found") diff --git a/ogclient/lib/python3/ProtocolLib.py b/ogclient/lib/python3/ProtocolLib.py index b4a17b2..18c8bb8 100644 --- a/ogclient/lib/python3/ProtocolLib.py +++ b/ogclient/lib/python3/ProtocolLib.py @@ -82,6 +82,7 @@ def ogUcastSyntax (op, sess, file=None, device=None, tool=None, level=None): address += f' -O {session[i]}:{portbase}' else: address = f'{session[1]}:{portbase}' + #print (f'nati mode ({mode}) address ({address})') if 'SENDPARTITION' == op: syn = ImageLib.ogCreateImageSyntax (device, ' ', tool, level) @@ -89,6 +90,7 @@ def ogUcastSyntax (op, sess, file=None, device=None, tool=None, level=None): ## otherwise, param2 in ImageLib.ogCreateImageSyntax() is not '| mbuffer' but empty ## and then parts[2] is out of range parts = syn.split ('|') + #print (f'nati syn ({syn}) parts ({parts})') prog1 = f'{parts[0]}|{parts[2]}'.strip() prog1 = prog1.replace ('>', '').strip() return f'{prog1} | mbuffer {address}' @@ -129,6 +131,7 @@ def ogUcastSendPartition (disk, par, sess, tool, level): cmd = ogUcastSyntax ('SENDPARTITION', sess, device=PART, tool=tool, level=level) if not cmd: return None + print (f'nati cmd ({cmd})') try: subprocess.run (cmd, shell=True, check=True) except subprocess.CalledProcessError: @@ -160,6 +163,7 @@ def ogUcastReceiverPartition (disk, par, sess, tool, level): cmd = ogUcastSyntax ('RECEIVERPARTITION', sess, device=PART, tool=tool, level=level) if not cmd: return None + print (f'nati cmd ({cmd})') try: subprocess.run (cmd, shell=True, check=True) except subprocess.CalledProcessError: @@ -204,6 +208,7 @@ def ogUcastSendFile (disk=None, par=None, container=None, file=None, sess=None): ## we were given container= source = FileLib.ogGetPath (src=container, file=file) dev_err = f'{container} {file}' + print (f'nati ogGetPath (src=({container}), file=({file})) = source ({source})') else: raise TypeError ('argument "container" can be specified along neither "disk" nor "par"') @@ -212,10 +217,12 @@ def ogUcastSendFile (disk=None, par=None, container=None, file=None, sess=None): ## we were given disk= par= source = FileLib.ogGetPath (src=f'{disk} {par}', file=file) dev_err = f'{disk} {par} {file}' + print (f'nati ogGetPath (src=({disk} {par}), file=({file})) = source ({source})') elif disk is None and par is None: ## we were given nothing source = FileLib.ogGetPath (file=file) dev_err = file + print (f'nati ogGetPath (file=({file})) = source ({source})') else: raise TypeError ('if one of "disk" and "par" are specified, then both must be') @@ -224,12 +231,14 @@ def ogUcastSendFile (disk=None, par=None, container=None, file=None, sess=None): return path2 = FileLib.ogGetPath (file=source) + print (f'nati path2 ({path2})') if not path2: SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dev_err} not found') return cmd = ogUcastSyntax ('SENDFILE', sess, file=source) if not cmd: return None + print (f'nati cmd ({cmd})') try: subprocess.run (cmd, shell=True, check=True) except subprocess.CalledProcessError: @@ -300,6 +309,7 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None): if 'SEND' in op: mode = 'server' else: mode = 'client' + print (f'nati mode ({mode})') try: isudpcast = subprocess.run (['udp-receiver', '--help'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout @@ -308,6 +318,7 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None): return session = sess.split (':') + print (f'nati sess ({sess}) session ({session})') PERROR = 0 if 'server' == mode: @@ -321,6 +332,7 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None): mbuffer = " --pipe 'mbuffer -q -m 20M' " portbase = int (session[0]) + print (f'nati portbase ({portbase})') if portbase not in range (9000, 9100, 2): SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'McastSession portbase {portbase}') PERROR = 3 @@ -360,6 +372,7 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None): if 'client' == mode: other = session[1:] + print (f'nati session ({session}) other ({other})') serveraddress = other[0] if len (other) > 0 else '' starttimeout = other[1] if len (other) > 1 else '' receivertimeout = other[2] if len (other) > 2 else '' @@ -370,16 +383,23 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None): else: repoip = NetLib.ogGetRepoIp() clientip = _clientip() + #print (f'nati repoip ({repoip}) clientip ({clientip})') if 1 != len (clientip): raise Exception ('more than one local IP address found') c = clientip[0] + #print (f'nati c ({c})') clientip = c['local'] mascara = c['prefixlen'] + #print (f'nati clientip ({clientip}) mascara ({mascara})') ripbt = _binary_ip (repoip) ipbt = _binary_ip (clientip) reposubred = ripbt[0:mascara] clientsubred = ipbt[0:mascara] + #print (f'nati ripbt ({ripbt})') + #print (f'nati ipbt ({ipbt})') + #print (f'nati reposubred ({reposubred})') + #print (f'nati clientsubred ({clientsubred})') if reposubred == clientsubred: serveraddress = ' ' else: serveraddress = f' --mcast-rdv-address {repoip}' @@ -407,6 +427,7 @@ def ogMcastSyntax (op, sess, file=None, device=None, tool=None, level=None): ## otherwise, param2 in ImageLib.ogCreateImageSyntax() is not '| mbuffer' but empty ## and then parts[2] is out of range parts = syn.split ('|') + #print (f'nati syn ({syn}) parts ({parts})') prog1 = f'{parts[0]}|{parts[2]}'.strip() prog1 = prog1.replace ('>', '').strip() return f'{prog1} | {syntaxserver}' @@ -462,6 +483,7 @@ def ogMcastSendFile (disk=None, par=None, container=None, file=None, sess=None): ## we were given container= source = FileLib.ogGetPath (src=container, file=file) dev_err = f'{container} {file}' + print (f'nati ogGetPath (src=({container}), file=({file})) = source ({source})') else: raise TypeError ('argument "container" can be specified along neither "disk" nor "par"') @@ -470,10 +492,12 @@ def ogMcastSendFile (disk=None, par=None, container=None, file=None, sess=None): ## we were given disk= par= source = FileLib.ogGetPath (src=f'{disk} {par}', file=file) dev_err = f'{disk} {par} {file}' + print (f'nati ogGetPath (src=({disk} {par}), file=({file})) = source ({source})') elif disk is None and par is None: ## we were given nothing source = FileLib.ogGetPath (file=file) dev_err = file + print (f'nati ogGetPath (file=({file})) = source ({source})') else: raise TypeError ('if one of "disk" and "par" are specified, then both must be') @@ -482,12 +506,14 @@ def ogMcastSendFile (disk=None, par=None, container=None, file=None, sess=None): return path2 = FileLib.ogGetPath (file=source) + print (f'nati path2 ({path2})') if not path2: SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'device or file {dev_err} not found') return cmd = ogMcastSyntax ('SENDFILE', sess, file=source) if not cmd: return None + print (f'nati cmd ({cmd})') try: subprocess.run (cmd, shell=True, check=True) except subprocess.CalledProcessError: @@ -526,6 +552,7 @@ def ogMcastReceiverFile (disk=None, par=None, container=None, file=None, sess=No ## we were given container= targetdir = FileLib.ogGetParentPath (src=container, file=file) dev_err = f'{container} {file}' + print (f'nati ogGetParentPath (src=({container}), file=({file})) = targetdir ({targetdir})') else: raise TypeError ('argument "container" can be specified along neither "disk" nor "par"') @@ -534,10 +561,12 @@ def ogMcastReceiverFile (disk=None, par=None, container=None, file=None, sess=No ## we were given disk= par= targetdir = FileLib.ogGetParentPath (src=f'{disk} {par}', file=file) dev_err = f'{disk} {par} {file}' + print (f'nati ogGetParentPath (src=({disk} {par}), file=({file})) = targetdir ({targetdir})') elif disk is None and par is None: ## we were given nothing targetdir = FileLib.ogGetParentPath (file=file) dev_err = file + print (f'nati ogGetParentPath (file=({file})) = targetdir ({targetdir})') else: raise TypeError ('if one of "disk" and "par" are specified, then both must be') @@ -546,9 +575,12 @@ def ogMcastReceiverFile (disk=None, par=None, container=None, file=None, sess=No return targetfile = os.path.basename (file) + print (f'nati targetfile ({targetfile})') + print (f'nati calling ogMcastSyntax with sess ({sess})') cmd = ogMcastSyntax ('RECEIVERFILE', sess, file=os.path.join (targetdir, targetfile)) if not cmd: return None + print (f'nati cmd ({cmd})') try: subprocess.run (cmd, shell=True, check=True) except subprocess.CalledProcessError: @@ -581,6 +613,7 @@ def ogMcastSendPartition (disk, par, sess, tool, compressor): FileSystemLib.ogUnmount (disk, par) cmd = ogMcastSyntax ('SENDPARTITION', sess, device=PART, tool=tool, level=compressor) if not cmd: return None + print (f'nati cmd ({cmd})') try: subprocess.run (cmd, shell=True, check=True) except subprocess.CalledProcessError: @@ -606,6 +639,7 @@ def ogMcastReceiverPartition (disk, par, sess, tool, compressor): FileSystemLib.ogUnmount (disk, par) cmd = ogMcastSyntax ('RECEIVERPARTITION', sess, device=PART, tool=tool, level=compressor) if not cmd: return None + print (f'nati cmd ({cmd})') try: subprocess.run (cmd, shell=True, check=True) except subprocess.CalledProcessError: @@ -659,6 +693,7 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre return None source = FileLib.ogGetPath (src=container, file=torrentfile) dev_err = f'{container} {torrentfile}' + print (f'nati ogGetPath (src=({container}), file=({torrentfile})) = source ({source})') else: raise TypeError ('argument "container" can be specified along neither "disk" nor "par"') @@ -667,6 +702,7 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre ## we were given disk= par= source = FileLib.ogGetPath (src=f'{disk} {par}', file=torrentfile) dev_err = f'{disk} {par} {torrentfile}' + print (f'nati ogGetPath (src=({disk} {par}), file=({torrentfile})) = source ({source})') elif disk is None and par is None: ## we were given nothing if torrentfile.startswith ('/opt/opengnsys/images'): @@ -674,6 +710,7 @@ def ogTorrentStart (disk=None, par=None, container=None, torrentfile=None, torre return None source = FileLib.ogGetPath (file=torrentfile) dev_err = torrentfile + print (f'nati ogGetPath (file=({torrentfile})) = source ({source})') else: raise TypeError ('if one of "disk" and "par" are specified, then both must be') @@ -788,6 +825,7 @@ def ogCreateTorrent (disk=None, par=None, container=None, file=None, ip_bttrack= return f = f'{file}.{ext}' source = FileLib.ogGetPath (src=container, file=f) + print (f'nati ogGetPath (src=({container}), file=({f})) = source ({source})') else: raise TypeError ('argument "container" can be specified along neither "disk" nor "par"') @@ -796,10 +834,12 @@ def ogCreateTorrent (disk=None, par=None, container=None, file=None, ip_bttrack= ## we were given disk= par= f = f'{file}.img' source = FileLib.ogGetPath (src=f'{disk} {par}', file=f) + print (f'nati ogGetPath (src=({disk} {par}), file=({f})) = source ({source})') elif disk is None and par is None: ## we were given nothing f = f'{file}.img' source = FileLib.ogGetPath (file=f) + print (f'nati ogGetPath (file=({f})) = source ({source})') else: raise TypeError ('if one of "disk" and "par" are specified, then both must be') @@ -850,12 +890,14 @@ def ogUpdateCacheIsNecesary (repo, file, proto): return None filesource = FileLib.ogGetPath (src=repo, file=file) + #print (f'nati filesource ({filesource})') if not filesource: SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f' {repo} {file}') return None # paso 1. si no existe la imagen, confirmar que es necesario actualizar la cache. filetarget = FileLib.ogGetPath (src='CACHE', file=file) + #print (f'nati filetarget ({filetarget})') if not filetarget: # borramos el fichero bf del torrent, en el caso de que se hubiese quedado de algun proceso fallido if FileLib.ogGetPath (src='CACHE', file=f'/{file}.torrent.bf'): ogDeleteFile (container='CACHE', file=f'{file}.torrent.bf') diff --git a/ogclient/lib/python3/RegistryLib.py b/ogclient/lib/python3/RegistryLib.py index 11a2c08..2657bd8 100644 --- a/ogclient/lib/python3/RegistryLib.py +++ b/ogclient/lib/python3/RegistryLib.py @@ -19,8 +19,10 @@ import FileLib # Función ficticia para lanzar chntpw con timeout de 5 s., evitando cuelgues del programa. chntpw_exe = shutil.which ('drbl-chntpw') or shutil.which ('chntpw') def chntpw (hivefile, input_file): + #print (f'nati: hivefile ({hivefile}) input_file ({input_file}) type ({type(input_file)})') with open (input_file, 'r') as fd: input_contents = fd.read() + #print (f'nati: input_contents ({input_contents})') return subprocess.run ([chntpw_exe, '-e', hivefile], timeout=5, input=input_contents, capture_output=True, text=True).stdout ## en el codigo bash aparecen "${3%\\*}" y "${3##*\\}" varias veces diff --git a/ogclient/lib/python3/SystemLib.py b/ogclient/lib/python3/SystemLib.py index d86b635..9bf67dd 100644 --- a/ogclient/lib/python3/SystemLib.py +++ b/ogclient/lib/python3/SystemLib.py @@ -3,7 +3,6 @@ import datetime from zoneinfo import ZoneInfo import sys import os -import json import shutil import inspect import glob @@ -21,7 +20,6 @@ import StringLib def _logtype2logfile (t): if 'log' == t.lower(): return ogGlobals.OGLOGFILE - if 'jsonlog' == t.lower(): return ogGlobals.OGJSONLOGFILE elif 'command' == t.lower(): return ogGlobals.OGLOGCOMMAND elif 'session' == t.lower(): return ogGlobals.OGLOGSESSION else: raise Exception (f'unknown log type ({t})') @@ -37,40 +35,24 @@ def ogEcho (logtypes, loglevel, msg): logfiles = ['/dev/stdout'] if type (logtypes) is list: for l in logtypes: - if 'log' == l: - logfiles.append (_logtype2logfile ('log')) - logfiles.append (_logtype2logfile ('jsonlog')) - else: - logfiles.append (_logtype2logfile (l)) + logfiles.append (_logtype2logfile (l)) else: ## string - if 'log' == logtypes: - logfiles.append (_logtype2logfile ('log')) - logfiles.append (_logtype2logfile ('jsonlog')) - else: - logfiles.append (_logtype2logfile (logtypes)) + logfiles.append (_logtype2logfile (logtypes)) if loglevel is None or 'help' == loglevel: if ogGlobals.DEBUG.lower() != "no": logfiles.append (ogGlobals.OGLOGFILE) - logfiles.append (ogGlobals.OGJSONLOGFILE) for f in logfiles: with open (f, 'a') as fd: - if ogGlobals.OGJSONLOGFILE == f: - fd.write (json.dumps ({'message':msg}) + '\n') - else: - fd.write (msg + '\n') + fd.write (msg + '\n') return if 'info' == loglevel or 'warning' == loglevel or 'error' == loglevel: - DATETIME = datetime.datetime.now (ZoneInfo (ogGlobals.TZ)).strftime ('%F %T %Z') - DATETIME_json = datetime.datetime.now (ZoneInfo (ogGlobals.TZ)).strftime ('%Y-%m-%d %H:%M:%S') + DATETIME = datetime.datetime.now(ZoneInfo(ogGlobals.TZ)).strftime("%F %T %Z") for f in logfiles: with open (f, 'a') as fd: - if ogGlobals.OGJSONLOGFILE == f: - fd.write (json.dumps ({'timestamp':DATETIME_json, 'severity':loglevel, 'message':msg}) + '\n') - else: - fd.write (f"OpenGnsys {loglevel} {DATETIME} {msg}\n") + fd.write (f"OpenGnsys {loglevel} {DATETIME} {msg}\n") else: raise Exception (f'unknown loglevel ({loglevel})') @@ -93,18 +75,10 @@ def ogExecAndLog (logtypes, fun, *args, **kwargs): if type (logtypes) is list: for l in logtypes: logtypes = list (map (lambda x: x.lower(), logtypes)) - if 'log' == l: - logfiles.append (_logtype2logfile ('log')) - logfiles.append (_logtype2logfile ('jsonlog')) - else: - logfiles.append (_logtype2logfile (l)) + logfiles.append (_logtype2logfile (l)) else: ## string logtypes = logtypes.lower() - if 'log' == logtypes: - logfiles.append (_logtype2logfile ('log')) - logfiles.append (_logtype2logfile ('jsonlog')) - else: - logfiles.append (_logtype2logfile (logtypes)) + logfiles.append (_logtype2logfile (logtypes)) if not fun: ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, 'no function provided') @@ -129,37 +103,45 @@ def ogExecAndLog (logtypes, fun, *args, **kwargs): # ## redirect stdout only # eval $COMMAND | tee -a $FILES + import time sout = serr = '' if 'command' in logtypes: os.unlink (ogGlobals.OGLOGCOMMAND) open (ogGlobals.OGLOGCOMMAND, 'w').close() + #print ('nati: ogExecAndLog: about to redirect stdout and stderr') + #time.sleep (1) ## nati with redirect_stdout (StringIO()) as r_stdout, redirect_stderr (StringIO()) as r_stderr: rc = fun (*args, **kwargs) sout = r_stdout.getvalue() serr = r_stderr.getvalue() + #print (f'nati: ogExecAndLog: end of redirections, rc ({rc}) sout ({sout}) serr ({serr})') + #time.sleep (1) ## nati else: + #print ('nati: ogExecAndLog: about to redirect stdout only') + #time.sleep (1) ## nati with redirect_stdout (StringIO()) as r_stdout: rc = fun (*args, **kwargs) sout = r_stdout.getvalue() + #print (f'nati: ogExecAndLog: end of redirections, rc ({rc}) sout ({sout})') + #time.sleep (1) ## nati rc_str = str (rc) if sout or serr or ('True' != rc_str and 'False' != rc_str and 'None' != rc_str): + #print ('nati: ogExecAndLog: sout or serr are true') + #time.sleep (1) ## nati for f in logfiles: + #print (f'nati: ogExecAndLog: logging to logfile ({f})') with open (f, 'a') as fd: - if ogGlobals.OGJSONLOGFILE == f: - if sout: fd.write (json.dumps ({'message':sout}) + '\n') - if serr: fd.write (json.dumps ({'message':serr}) + '\n') - if rc_str: fd.write (json.dumps ({'message':rc_str}) + '\n') - else: - if sout: fd.write (f'{sout}\n') - if serr: fd.write (f'{serr}\n') - if rc_str: fd.write (f'{rc_str}\n') - #fd.write (f"ogExecAndLog: {fun.__name__} rc:\n{rc_str}\n") - #if sout: fd.write (f"ogExecAndLog: {fun.__name__} stdout:\n{sout}\n") - #else: fd.write (f"ogExecAndLog: {fun.__name__} stdout: (none)\n") - #if serr: fd.write (f"ogExecAndLog: {fun.__name__} stderr:\n{serr}\n") - #else: fd.write (f"ogExecAndLog: {fun.__name__} stderr: (none)\n") + if sout: fd.write (f'{sout}\n') + if serr: fd.write (f'{serr}\n') + if rc_str: fd.write (f'{rc_str}\n') + #fd.write (f"ogExecAndLog: {fun.__name__} rc:\n{rc_str}\n") + #if sout: fd.write (f"ogExecAndLog: {fun.__name__} stdout:\n{sout}\n") + #else: fd.write (f"ogExecAndLog: {fun.__name__} stdout: (none)\n") + #if serr: fd.write (f"ogExecAndLog: {fun.__name__} stderr:\n{serr}\n") + #else: fd.write (f"ogExecAndLog: {fun.__name__} stderr: (none)\n") + #print (f'nati: ogExecAndLog: returning rc ({rc})') return rc #/** @@ -283,6 +265,7 @@ def ogRaiseError (logtypes, code, msg): if code == ogGlobals.OG_ERR_FORMAT or \ (str_call_stack in ogGlobals.NODEBUGFUNCTIONS) or \ not (len(call_stack)>0 and (call_stack[0] in ogGlobals.NODEBUGFUNCTIONS)): + #print ('nati: ogRaiseError: actually calling ogEcho') ogEcho (logtypes, "error", f"{str_call_stack.replace(' ', '<-')}: {MSG}") return code diff --git a/ogclient/lib/python3/ogGlobals.py b/ogclient/lib/python3/ogGlobals.py index f1901fd..c744b2c 100644 --- a/ogclient/lib/python3/ogGlobals.py +++ b/ogclient/lib/python3/ogGlobals.py @@ -6,6 +6,10 @@ import os.path import locale import importlib.util +## required for defining OGLOGFILE +import NetLib +ip = NetLib.ogGetIpAddress() + def load_lang (name): global lang if name in sys.modules: @@ -61,8 +65,8 @@ OGPYFUNCS = os.path.join (OPENGNSYS, 'functions') OGSCRIPTS = os.path.join (OPENGNSYS, 'scripts') OGIMG = os.path.join (OPENGNSYS, 'images') OGCAC = os.path.join (OPENGNSYS, 'cache') -OGLOGFILE = '/var/log/clone-engine.log' -OGJSONLOGFILE = '/var/log/clone-engine.json.log' +OGLOG = os.path.join (OPENGNSYS, 'log') +OGLOGFILE = f'{OGLOG}/{ip}.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]) diff --git a/ogclient/scripts/bootOs.py b/ogclient/scripts/bootOs.py deleted file mode 100755 index 28357ed..0000000 --- a/ogclient/scripts/bootOs.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python3 -# Script de ejemplo para arancar un sistema operativo instalado. -# Nota: se usa como base para el programa de arranque de OpenGnsys Admin. - -import sys -import re -import subprocess -import shutil - -import ogGlobals -from SystemLib import ogRaiseError, ogEcho -from DiskLib import ogDiskToDev -from FileSystemLib import ogMount, ogUnmount, ogCheckFs, ogUnmountAll -from CacheLib import ogUnmountCache -from BootLib import ogBoot - -prog = sys.argv[0] -if len (sys.argv) < 3 or len (sys.argv) > 4: - ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'Formato: {prog} ndisco nfilesys [str_kernel str_initrd str_kernelparams]') - sys.exit (1) -disk, par, *other = sys.argv[1:] -params = other[0] if len (other) > 0 else '' - -# Comprobar errores. -part = ogDiskToDev (disk, par) -if not part: sys.exit (1) -mntdir = ogMount (disk, par) -if not mntdir: sys.exit (1) - -print ('[0] Inicio del proceso de arranque.') - -# Si el equipo está hibernado chequeamos el f.s. y borramos el hiberfile (error cod.6) -mount_out = subprocess.run (['mount'], capture_output=True, text=True).stdout -if not mount_out or not re.search (rf'{mntdir}.*\(rw', mount_out): - ogEcho (['log', 'session'], None, f'{ogGlobals.lang.MSG_WARNING}: {ogGlobals.lang.MSG_MOUNTREADONLY}') - ogUnmount (disk, par) - ogCheckFs (disk, par) - - part = ogDiskToDev (disk, par) - os.makedirs (mntdir, exist_ok=True) - subprocess.run (['ntfs-3g', '-o', 'remove_hiberfile', part, mntdir]) - ogEcho (['log', 'session'], None, 'Particion desbloqueada') - - ogUnmount (disk, par) - ogMount (disk, par) - -if shutil.which ('bootOsCustom.py'): - print ('[10] Configuración personalizada del inicio.') - subprocess.run ([f'{ogGlobals.OGSCRIPTS}/bootOsCustom.py']) - -print ('[70] Desmontar todos los sistemas de archivos.') -subprocess.run (['sync']) -for i in range (1, 1+len(ogDiskToDev())): - ogUnmountAll (i) -print ('[80] Desmontar cache local.') -ogUnmountCache() -print (f'[90] Arrancar sistema operativo.') -ogBoot (disk, par, params=params) diff --git a/ogclient/scripts/deployImage.py b/ogclient/scripts/deployImage.py index 4070fb4..e5a2ec2 100755 --- a/ogclient/scripts/deployImage.py +++ b/ogclient/scripts/deployImage.py @@ -145,10 +145,6 @@ def main (repo, imgname, disk, par, proto='UNICAST', protoopt=''): SystemLib.ogEcho (['log', 'session'], None, f'[55] {ogGlobals.lang.MSG_HELP_ogRestoreImage}: restoreImage {params}') retval = subprocess.run (['restoreImage.py'] + params).returncode - ## turn shell's success into python success (without ending up with True or False) - if retval: retval = 0 - else: retval = 1 - # Mostrar resultados. resumerestoreimage = subprocess.run (['grep', '--max-count', '1', 'Total Time:', ogGlobals.OGLOGCOMMAND], capture_output=True, text=True).stdout SystemLib.ogEcho (['log', 'session'], None, f' [ ] {resumerestoreimage} ') diff --git a/ogclient/scripts/getIpAddress.py b/ogclient/scripts/getIpAddress.py new file mode 100755 index 0000000..65f62aa --- /dev/null +++ b/ogclient/scripts/getIpAddress.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +import sys +import NetLib + +def get_ip_address(*args): + try: + # Llama a ogGetIpAddress desde NetLib y captura el resultado + result = NetLib.ogGetIpAddress(*args) + print(result.strip()) + except Exception as e: + print(f"Error ejecutando ogGetIpAddress: {e}", file=sys.stderr) + sys.exit(1) + +if __name__ == "__main__": + get_ip_address(*sys.argv[1:]) + diff --git a/ogclient/scripts/initCache.py b/ogclient/scripts/initCache.py index a0e038a..8a45ca8 100755 --- a/ogclient/scripts/initCache.py +++ b/ogclient/scripts/initCache.py @@ -47,9 +47,8 @@ def main (NDISK, NPART, SIZE, MOUNT): if SIZE != CACHESIZE: print("[10] Crear partición de caché local.") CacheLib.ogUnmountCache() - if not CacheLib.ogCreateCache (NDISK, NPART, SIZE): - SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_CACHE, 'failed to create cache') - return False + print (f'nati: calling ogCreateCache ({NDISK}, {NPART}, {SIZE})') + CacheLib.ogCreateCache (NDISK, NPART, SIZE) DiskLib.ogUpdatePartitionTable() # Si caché no montada y no formateada o cambia el tamaño: formatear. @@ -105,19 +104,23 @@ if __name__ == "__main__": NPART = int (args[1]) SIZE = int (args[2]) else: + print (f'nati: params no es ni 1 ni 2 ni 3 sino ({PARAMS})') SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT) sys.exit (1) except ValueError: + print (f'nati: ValueError') SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT) sys.exit (1) # Si disco o partición no son mayores o iguales que 1, error. if NDISK < 1 or NPART < 1: + print (f'nati: ndisk<1 or npart<1, ({NDISK}) ({NPART})') SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT) sys.exit (1) # Si tamaño no es numérico o tamaño<-1, error. if SIZE < -1: + print (f'nati: SIZE<-1 ({SIZE})') SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, EXECFORMAT) sys.exit (1) diff --git a/ogclient/scripts/listHardwareInfo.py b/ogclient/scripts/listHardwareInfo.py index 5993f07..d702212 100755 --- a/ogclient/scripts/listHardwareInfo.py +++ b/ogclient/scripts/listHardwareInfo.py @@ -21,7 +21,7 @@ if len (sys.argv) > 1: #SERVERLOGDIR = unused # Fichero de listado: hard-IP -HARDFILE = f'/tmp/hard-{ogGetIpAddress()}' +HARDFILE = f'{ogGlobals.OGLOG}/hard-{ogGetIpAddress()}' out = ogListHardwareInfo() with open (HARDFILE, 'w') as fd: fd.write (out) diff --git a/ogclient/scripts/listSoftwareInfo.py b/ogclient/scripts/listSoftwareInfo.py index f92cdbd..1c2756e 100755 --- a/ogclient/scripts/listSoftwareInfo.py +++ b/ogclient/scripts/listSoftwareInfo.py @@ -18,7 +18,7 @@ prog = os.path.basename (sys.argv[0]) def main (disk, par, reduced): ip = NetLib.ogGetIpAddress() - softfile = f'/tmp/soft-{ip}-{disk}-{par}' + softfile = f'{ogGlobals.OGLOG}/soft-{ip}-{disk}-{par}' software_list = InventoryLib.ogListSoftware (disk, par) if reduced: diff --git a/ogclient/scripts/restoreImage.py b/ogclient/scripts/restoreImage.py index 961b971..a5f0ff6 100644 --- a/ogclient/scripts/restoreImage.py +++ b/ogclient/scripts/restoreImage.py @@ -114,5 +114,5 @@ t = time.time() - t0 SystemLib.ogEcho (['log', 'session'], None, f'[100] Duracion de la operacion {int (t/60)}m {int (t%60)}s') # Código de salida del comando prinicpal de restauración. -sys.exit (not retval) ## negated for the shell +sys.exit (retval) diff --git a/ogclient/scripts/updateCache.py b/ogclient/scripts/updateCache.py index b063a44..179781c 100644 --- a/ogclient/scripts/updateCache.py +++ b/ogclient/scripts/updateCache.py @@ -144,6 +144,7 @@ if sizerequired >= cachesizefree: sys.exit (1) # Comprobamos que imagen cache igual a la del repo. Si sincronizada no podemos comprobar. +## nati: esto ya lo hicimos mas arriba... rc = ProtocolLib.ogUpdateCacheIsNecesary (repositorio, path, protocolo) # si rc=True: actualizamos; si rc=False: no actualizamos (exit 0); si rc=None: exit error if rc == True: pass ## es necesario actualizar