1
0
Fork 0

Compare commits

..

64 Commits

Author SHA1 Message Date
Natalia Serrano 7624964ba1 Merge pull request 'refs #1925 send /stopped on poweroff or restart' (#33) from agent-stopped-on-poweroff into main
Reviewed-on: opengnsys/ogclone-engine#33
2025-04-23 13:59:20 +02:00
Natalia Serrano c3e86b7dc0 refs #1925 send /stopped on poweroff or restart 2025-04-23 13:58:51 +02:00
Natalia Serrano a18e861bea Merge pull request 'refs #1912 fix a couple of rc' (#32) from test-configurar-py into main
Reviewed-on: opengnsys/ogclone-engine#32
2025-04-21 12:49:14 +02:00
Natalia Serrano 842dbf48c2 refs #1912 fix a couple of rc 2025-04-21 12:48:47 +02:00
Natalia Serrano d79c677f16 Merge pull request 'refs #1918 fix getConfiguration.py' (#31) from fix-getConfiguration into main
Reviewed-on: opengnsys/ogclone-engine#31
2025-04-15 17:56:50 +02:00
Natalia Serrano bd056438a1 refs #1918 fix getConfiguration.py 2025-04-15 17:56:27 +02:00
Natalia Serrano fb665fa4ca Merge pull request 'refs #1908 remove refs to OGLOG' (#30) from remove-OGLOG into main
Reviewed-on: opengnsys/ogclone-engine#30
2025-04-15 17:17:18 +02:00
Natalia Serrano c76fd8388a refs #1908 remove refs to OGLOG 2025-04-15 17:16:48 +02:00
Natalia Serrano fac6e142f6 Merge pull request 'refs #1914 fix a couple of bugs' (#29) from fix-restaurar-imagen into main
Reviewed-on: opengnsys/ogclone-engine#29
2025-04-15 17:07:07 +02:00
Natalia Serrano e20bd46edb refs #1914 fix a couple of bugs 2025-04-15 17:06:34 +02:00
Natalia Serrano f785143b73 Merge pull request 'refs #1916 move ogGetIpAddress to NetLib' (#28) from move-ogGetIpAddress into main
Reviewed-on: opengnsys/ogclone-engine#28
2025-04-15 17:04:00 +02:00
Natalia Serrano bf85cb1fed refs #1916 move ogGetIpAddress to NetLib 2025-04-15 17:03:31 +02:00
Natalia Serrano e885302256 Merge pull request 'oglog' (#27) from oglog into main
Reviewed-on: opengnsys/ogclone-engine#27
2025-04-15 16:58:15 +02:00
Natalia Serrano ad3388d36e Merge branch 'main' into oglog 2025-04-15 16:56:51 +02:00
Natalia Serrano 46238456cb refs #1838 log to /var/log instead of the shared /opt/opengnsys/log 2025-04-15 16:55:45 +02:00
Natalia Serrano 0179d106e9 refs #1838 log to /var/log instead of the shared /opt/opengnsys/log 2025-04-15 16:54:06 +02:00
Nicolas Arenas 697c60f812 Publish in nightlys 2025-04-10 16:26:15 +02:00
Natalia Serrano 4353c74768 Merge pull request 'refs #1879 negate rc to the shell' (#25) from negate-rc-for-shell into main
Reviewed-on: opengnsys/ogclone-engine#25
2025-04-10 13:33:26 +02:00
Natalia Serrano 2c18e6981f refs #1879 negate rc to the shell 2025-04-10 13:32:48 +02:00
Natalia Serrano c1f123b489 Merge pull request 'refs #1878 makes writable Samba export in ogclient' (#24) from make_samba_public into main
Reviewed-on: opengnsys/ogclone-engine#24
2025-04-10 09:41:27 +02:00
Natalia Serrano 1f92f54994 refs #1878 update changelog 2025-04-10 09:41:08 +02:00
Nicolas Arenas bbaa6578e1 refs #1878 makes writable Samba export in ogclient 2025-04-10 08:11:04 +02:00
Natalia Serrano e1a1be667b Merge pull request 'fix-ogReduceFs' (#23) from fix-ogReduceFs into main
Reviewed-on: opengnsys/ogclone-engine#23
2025-04-09 18:36:47 +02:00
Natalia Serrano 44511c79a0 refs #1876 change check and improve debug msg 2025-04-09 18:36:11 +02:00
Natalia Serrano a1493a827e refs #1876 change check and improve debug msg 2025-04-09 17:47:51 +02:00
Natalia Serrano 0352e3a2cc Merge pull request 'refs #1874 fix syntax' (#22) from fix-syntax into main
Reviewed-on: opengnsys/ogclone-engine#22
2025-04-09 17:34:55 +02:00
Natalia Serrano e76fe57b1b refs #1874 fix syntax 2025-04-09 17:34:29 +02:00
Natalia Serrano 793705953f Merge pull request 'refs #1874 fix usage of ogEcho' (#21) from fix-ogEcho into main
Reviewed-on: opengnsys/ogclone-engine#21
2025-04-09 17:20:34 +02:00
Natalia Serrano 782e5c8978 refs #1874 fix usage of ogEcho 2025-04-09 17:20:03 +02:00
Natalia Serrano 0e979c46fa Merge pull request 'refs #1872 always kill browser before exiting' (#20) from configurar-defunct into main
Reviewed-on: opengnsys/ogclone-engine#20
2025-04-09 11:25:19 +02:00
Natalia Serrano 6cbe28272f refs #1872 always kill browser before exiting 2025-04-09 11:24:49 +02:00
Natalia Serrano 565e3d4091 Merge pull request 'refs #1802 fix functions/ogCopyFile args handling' (#19) from fix-restore-torrent into main
Reviewed-on: opengnsys/ogclone-engine#19
2025-04-07 10:54:12 +02:00
Natalia Serrano 5e9fb86f9f refs #1802 fix functions/ogCopyFile args handling 2025-04-07 10:53:29 +02:00
Natalia Serrano df16663594 Merge pull request 'refs #1801 fix invocation to ogCheckIpAddress' (#18) from fix-stringlib into main
Reviewed-on: opengnsys/ogclone-engine#18
2025-04-03 14:11:27 +02:00
Natalia Serrano 48f6a41838 refs #1801 fix invocation to ogCheckIpAddress 2025-04-03 14:10:15 +02:00
Natalia Serrano 288aa9cf09 Merge pull request 'refs #1749 remove burg and rsync 3.1' (#17) from delete-stuff2 into main
Reviewed-on: opengnsys/ogclone-engine#17
2025-04-03 14:04:19 +02:00
Natalia Serrano 9847cad6a9 refs #1749 remove burg and rsync 3.1 2025-04-03 13:57:24 +02:00
Natalia Serrano 1be353aa1d Merge pull request 'Revert "refs #1749 remove burg, QT4 stuff, rsync 3.1 and the old browser"' (#16) from restore-browser into main
Reviewed-on: opengnsys/ogclone-engine#16
2025-03-31 17:54:58 +02:00
Natalia Serrano 78b76bcd6c Revert "refs #1749 remove burg, QT4 stuff, rsync 3.1 and the old browser"
This reverts commit 90dd04b1db.
2025-03-31 17:53:19 +02:00
Natalia Serrano 14b0f2db47 Merge pull request 'refs #1787 do not require protoopts' (#15) from protoopts into main
Reviewed-on: opengnsys/ogclone-engine#15
2025-03-31 12:55:58 +02:00
Natalia Serrano f577311277 refs #1787 do not require protoopts 2025-03-31 12:55:02 +02:00
Natalia Serrano a580a1a516 Merge pull request 'delete-stuff' (#14) from delete-stuff into main
Reviewed-on: opengnsys/ogclone-engine#14
2025-03-28 14:35:14 +01:00
Natalia Serrano feb4a80222 refs #1749 remove burg, QT4 stuff, rsync 3.1 and the old browser 2025-03-28 14:34:15 +01:00
Natalia Serrano 90dd04b1db refs #1749 remove burg, QT4 stuff, rsync 3.1 and the old browser 2025-03-28 14:33:09 +01:00
Natalia Serrano 85b7ef1452 Merge pull request 'fix-create-partitions' (#13) from fix-create-partitions into main
Reviewed-on: opengnsys/ogclone-engine#13
2025-03-28 14:10:12 +01:00
Natalia Serrano 280d160a7a refs #1779 remove lots of internal debug stuff 2025-03-28 14:05:11 +01:00
Natalia Serrano 3d35f0029b refs #1779 fix some bugs, remove internal debug stuff 2025-03-28 13:51:37 +01:00
Natalia Serrano ee164eda7b refs #1779 fix some bugs, remove internal debug stuff 2025-03-28 12:17:25 +01:00
Nicolas Arenas 2436904931 Updated jenkinsfile 2025-03-27 09:29:18 +01:00
Nicolas Arenas b470c6e11f Updated jenkinsfile 2025-03-27 09:27:50 +01:00
Nicolas Arenas f0c6856a55 Updated jenkinsfile 2025-03-27 09:25:23 +01:00
Nicolas Arenas 42b5e7a827 Fixes permissions and samba configuration 2025-03-26 19:24:12 +01:00
Natalia Serrano d748bb18d1 Merge pull request 'refs #1773 do not capture output' (#12) from capture-output into main
Reviewed-on: opengnsys/ogclone-engine#12
2025-03-26 12:09:56 +01:00
Natalia Serrano 8a02db31cf refs #1773 do not capture output 2025-03-26 12:08:14 +01:00
Natalia Serrano ba42dd9f42 Merge pull request 'ejecutarscript-bash' (#11) from ejecutarscript-bash into main
Reviewed-on: opengnsys/ogclone-engine#11
2025-03-26 11:58:14 +01:00
Natalia Serrano 8dc0e1933a refs #1770 do subprocess.run(bash,script) 2025-03-26 11:53:52 +01:00
Natalia Serrano 160e4abad1 refs #1770 do subprocess.run(bash,script) 2025-03-26 11:52:25 +01:00
Natalia Serrano 9b1985fd8c Merge pull request 'refs #1752 release version 0.2.0' (#10) from release-0.2 into main
Reviewed-on: opengnsys/ogclone-engine#10
2025-03-24 13:08:13 +01:00
Natalia Serrano 806c0f63ac refs #1752 release version 0.2.0 2025-03-24 13:07:10 +01:00
Natalia Serrano bc1bb3b0c2 Merge pull request 'firmware-type' (#9) from firmware-type into main
Reviewed-on: opengnsys/ogclone-engine#9
2025-03-21 14:15:54 +01:00
Natalia Serrano b39b8d9a03 refs #1744 automatically figure PTT out 2025-03-21 14:14:55 +01:00
Natalia Serrano 9108f4f1fe refs #1744 automatically figure PTT out 2025-03-21 14:12:42 +01:00
Natalia Serrano 21770526e5 refs #1735 collect firmware type 2025-03-21 13:59:17 +01:00
Natalia Serrano c5eeccde1f Merge pull request 'thin-wrappers' (#8) from thin-wrappers into main
Reviewed-on: opengnsys/ogclone-engine#8
2025-03-20 10:00:02 +01:00
123 changed files with 388 additions and 978 deletions

View File

@ -1,5 +1,149 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.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

View File

@ -48,16 +48,22 @@ 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 {
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
'''
script {
construirPaquete(env.BUILD_DIR, "../artifacts", "172.17.8.68", "/var/tmp/opengnsys/debian-repo/ogclient")
}
}
}
@ -69,7 +75,24 @@ pipeline {
}
agent { label 'debian-repo' }
steps {
sh "aptly repo add opengnsys-devel /var/tmp/opengnsys/debian-repo/ogclient/*.deb"
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)
}
}
}
}

View File

@ -23,13 +23,7 @@ case "$1" in
cp -a "$OLD_FILE" "$NEW_FILE"
# Append our configuration
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"
echo "include = /etc/samba/smb-ogclient.conf" >> "$OLD_FILE"
# Reload Samba
if command -v systemctl >/dev/null 2>&1; then
@ -48,6 +42,8 @@ case "$1" in
;;
esac
chown -R opengnsys:opengnsys /opt/opengnsys/ogclient
chown -R opengnsys:opengnsys /opt/opengnsys/ogclient_log
#DEBHELPER#
exit 0

15
debian/ogclient.preinst vendored 100644
View File

@ -0,0 +1,15 @@
#!/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

View File

@ -1,7 +1,7 @@
[ogclient]
comment = OpenGnsys Client
browseable = no
writeable = no
writeable = yes
locking = no
path = /opt/opengnsys/ogclient
guest ok = no

Binary file not shown.

View File

@ -55,6 +55,9 @@ 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:

View File

@ -2,6 +2,9 @@
import os
import sys
import time
os.system ('pkill -f OGAgent')
time.sleep (3)
os.system ('poweroff')
sys.exit (0)

View File

@ -9,6 +9,7 @@ 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
@ -61,23 +62,24 @@ 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 = ptt = tch = None
dis = tch = None
for item in tbprm:
if '=' not in item: continue
k, v = item.split ('=', 1)
if k not in ['dis', 'tch', 'ptt']: ## 'ptt' added, unused 'che' removed
if k not in ['dis', 'tch']:
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: sys.exit (ogGlobals.OG_ERR_FORMAT)
if ptt is None: ptt = 'MSDOS'
if tch is None: tch = '0'
if dis is None:
coproc.kill()
sys.exit (ogGlobals.OG_ERR_FORMAT)
if tch is None:
tch = '0'
# Toma valores de distribución de particiones, separados por "%".
tbp = [] # Valores de configuración (parámetros para ogCreatePartitions)
@ -112,6 +114,7 @@ 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.
@ -138,18 +141,21 @@ 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}')
SystemLib.ogExecAndLog ('command', CacheLib.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)
# Definir particionado.
SystemLib.ogEcho (['session', 'log'], None, f'[50] {ogGlobals.lang.MSG_HELP_ogCreatePartitions}')

View File

@ -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 StringLib.ogCheckIpAddress (repo):
if 'REPO' == repo or ogCheckIpAddress (repo):
# Si falla el cambio -> salimos con error repositorio no valido
if not ogChangeRepo (repo):
ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, repo)

View File

@ -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 (script_path, capture_output=True, text=True).returncode
RETVAL = subprocess.run (['bash', script_path]).returncode
TIME = time.time() - TIME1

View File

@ -2,6 +2,9 @@
import os
import sys
import time
os.system ('pkill -f OGAgent')
time.sleep (3)
os.system ('reboot')
sys.exit (0)

View File

@ -19,11 +19,11 @@ import ogGlobals
if __name__ == '__main__':
prog = sys.argv[0]
if len (sys.argv) < 7:
print (f'Usage: {prog} <disk> <partition> <image_name> <repo_ip> <protocol> <protocol_options> [additional_args...]')
if len (sys.argv) < 6:
print (f'Usage: {prog} <disk> <partition> <image_name> <repo_ip> <protocol> [protocol_options] [additional_args...]')
sys.exit (1)
disk, par, imgname, repo, proto, protoopt, *extra = sys.argv[1:]
disk, par, imgname, repo, proto, *extra = sys.argv[1:]
rc = subprocess.run ([f'{ogGlobals.OGSCRIPTS}/deployImage.py', repo, imgname, disk, par, proto, protoopt] + extra).returncode
rc = subprocess.run ([f'{ogGlobals.OGSCRIPTS}/deployImage.py', repo, imgname, disk, par, proto] + extra).returncode
sys.exit (rc)

View File

@ -1,105 +1,78 @@
#!/usr/bin/python3
#_______________________________________________________________________________________________________________________________
#
# Formato de salida:
# disk=Número de disco\tpar=Número de particion\tcod=Código de partición\tsfi=Sistema de ficheros\tsoi=Sistema instalado\ttam=Tamaño de la partición\n
#_______________________________________________________________________________________________________________________________
import os
import glob
import subprocess
from InventoryLib import ogGetSerialNumber, ogGetOsVersion
from InventoryLib import ogGetSerialNumber, ogGetOsVersion, ogIsEfiActive
from DiskLib import ogDiskToDev, ogGetPartitionsNumber, ogGetPartitionTableType, ogGetDiskSize, ogGetPartitionId, ogGetPartitionSize
from FileSystemLib import ogMount, ogGetMountPoint, ogGetFsType
# No registrar los errores.
#os.environ['DEBUG'] = 'no'
ser = ogGetSerialNumber()
cfg = ''
fwt = 'UEFI' if ogIsEfiActive() else 'BIOS'
print (f'ser={ser}\nfwt={fwt}')
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,
}
ptt = ptt_map.get (ptt, 0)
for dsk in range (1, disks+1):
particiones = ogGetPartitionsNumber (dsk)
particiones = int (particiones) if particiones else 0
# Tipo de tabla de particiones: 1=MSDOS, 2=GPT
ptt = ogGetPartitionTableType (dsk)
ptt_map = {
'MSDOS': 1,
'GPT': 2,
'LVM': 3,
'ZPOOL': 4,
}
ptt = ptt_map.get (ptt, 0)
# Información de disco (partición 0)
s = ogGetDiskSize (dsk)
cfg += f'{dsk}:0:{ptt}:::{s}:0;'
for par in range (1, particiones+1):
# Código del identificador de tipo de partición
cod = ogGetPartitionId (dsk, par)
# 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
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 not soi:
# Información de disco (partición 0)
s = ogGetDiskSize (dsk)
print (f'disk={dsk}\tpar=0\tcpt={ptt}\tfsi=\tsoi=\ttam={s}\tuso=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)
# 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)
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'
# Obtener porcentaje de uso.
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'
else:
soi = ''
uso = '0'
# Hacer un 2º intento para algunos casos especiales.
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'
else:
soi = ''
uso = '0'
cfg += f'{dsk}:{par}:{cod}:{fsi}:{soi}:{tam}:{uso};'
# Crear configuración por defecto para cliente sin disco.
if not cfg:
cfg = '1:0:0:::0;'
# Guardar salida en fichero temporal.
cfgfile = '/tmp/getconfig'
with open (cfgfile, 'w') as f:
if ser: f.write (f'{ser};\n')
f.write (cfg + '\n')
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')
# 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'])
# Componer salida formateada.
awk_script = r'''{ n=split($0,sep,";");
for (i=1; i<n; i++){
c=split (sep[i],dua,":");
if (i==1 && c==1)
printf ("ser=%s\n", dua[1]);
else
printf ("disk=%s\tpar=%s\tcpt=%s\tfsi=%s\tsoi=%s\ttam=%s\tuso=%s\n",
dua[1],dua[2],dua[3],dua[4],dua[5],dua[6],dua[7]);
}
}
'''
subprocess.run (['awk', awk_script, cfgfile])
# Borramos marcas de arranque de Windows
for f in glob.glob ('/mnt/*/ogboot.*') + glob.glob ('/mnt/*/*/ogboot.*'):
os.unlink (f)
# Volver a registrar los errores.
#os.environ.pop('DEBUG', None)
try: os.unlink (f)
except: pass

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

View File

@ -1,79 +0,0 @@
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" }
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,21 +0,0 @@
+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" }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

Some files were not shown because too many files have changed in this diff Show More