parent
5e7b60366f
commit
96ae327551
|
@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.22.4] - 2025-07-01
|
||||
|
||||
### Changed
|
||||
|
||||
- Do copy grub.cfg :) and clean it up on boot
|
||||
- Remove warning about /dev/loop0
|
||||
- Comment unused code out
|
||||
|
||||
## [0.22.3] - 2025-06-27
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
F=/opt/opengnsys/functions
|
||||
|
||||
## BootLib.bootOs() makes a copy of grub.cfg in /boot/grub within the ESP
|
||||
## clean it up
|
||||
if $F/ogIsEfiActive; then
|
||||
ESP=$($F/ogGetEsp)
|
||||
MNTPT=$($F/ogMount $ESP)
|
||||
rm -f $MNTPT/boot/grub/grub.cfg
|
||||
$F/ogUnmount $ESP
|
||||
fi
|
|
@ -5,7 +5,7 @@ set -a
|
|||
source /opt/opengnsys/etc/preinit/loadenviron.sh
|
||||
|
||||
# Scripts de inicio.
|
||||
for f in fileslinks loadmodules metadevs mountrepo poweroff otherservices; do
|
||||
for f in cleanesp fileslinks loadmodules metadevs mountrepo poweroff otherservices; do
|
||||
source $OGETC/preinit/$f.sh
|
||||
done
|
||||
unset f
|
||||
|
|
|
@ -126,6 +126,14 @@ def ogBoot (disk, par, nvramperm=False, params=''):
|
|||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'{esp} Boot loader')
|
||||
return None
|
||||
|
||||
esp_dev = DiskLib.ogDiskToDev (efidisk, efipart)
|
||||
esp_mntdir = esp_dev.replace ('dev', 'mnt')
|
||||
os.makedirs (f'{esp_mntdir}/boot/grub', exist_ok=True)
|
||||
grub_cfg_src = f'{esp_mntdir}/EFI/{bootlabel}/Boot/grub.cfg'
|
||||
if not os.path.exists (grub_cfg_src):
|
||||
grub_cfg_src = f'{esp_mntdir}/boot/grubMBR/boot/grub/grub.cfg'
|
||||
shutil.copy2 (grub_cfg_src, f'{esp_mntdir}/boot/grub/grub.cfg')
|
||||
|
||||
# Crear orden de arranque (con unos valores por defecto).
|
||||
UEFILib.ogNvramAddEntry (bootlabel, f'/EFI/{bootlabel}/Boot/{bootloader}', nvramperm)
|
||||
# Marcar próximo arranque y reiniciar.
|
||||
|
@ -156,6 +164,14 @@ def ogBoot (disk, par, nvramperm=False, params=''):
|
|||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTOS, f'{disk} {par} ({type}, EFI)')
|
||||
return None
|
||||
|
||||
esp_dev = DiskLib.ogDiskToDev (efidisk, efipart)
|
||||
esp_mntdir = esp_dev.replace ('dev', 'mnt')
|
||||
os.makedirs (f'{esp_mntdir}/boot/grub', exist_ok=True)
|
||||
grub_cfg_src = f'{esp_mntdir}/EFI/{bootlabel}/Boot/grub.cfg'
|
||||
if not os.path.exists (grub_cfg_src):
|
||||
grub_cfg_src = f'{esp_mntdir}/boot/grubMBR/boot/grub/grub.cfg'
|
||||
shutil.copy2 (grub_cfg_src, f'{esp_mntdir}/boot/grub/grub.cfg')
|
||||
|
||||
# Crear orden de arranque (con unos valores por defecto).
|
||||
l = re.sub ('^.*EFI(.*)$', r'\1', loader)
|
||||
UEFILib.ogNvramAddEntry (bootlabel, '/EFI'+l, nvramperm)
|
||||
|
|
|
@ -400,7 +400,8 @@ def ogDevToDisk(arg_dev):
|
|||
# Error si no es fichero de bloques o directorio (para LVM).
|
||||
m = os.stat (DEV, follow_symlinks=True).st_mode
|
||||
if not stat.S_ISBLK (m) and not stat.S_ISDIR (m):
|
||||
SystemLib.ogRaiseError([], ogGlobals.OG_ERR_NOTFOUND, arg_dev)
|
||||
if '/dev/loop' != DEV[0:9]:
|
||||
SystemLib.ogRaiseError([], ogGlobals.OG_ERR_NOTFOUND, arg_dev)
|
||||
return
|
||||
|
||||
# Buscar en fichero de caché de discos.
|
||||
|
@ -424,7 +425,8 @@ def ogDevToDisk(arg_dev):
|
|||
return f"{n} {DEV[len(d) + len(NVME_PREFIX):]}"
|
||||
n += 1
|
||||
|
||||
SystemLib.ogRaiseError([], ogGlobals.OG_ERR_NOTFOUND, arg_dev)
|
||||
if '/dev/loop' != DEV[0:9]:
|
||||
SystemLib.ogRaiseError([], ogGlobals.OG_ERR_NOTFOUND, arg_dev)
|
||||
return
|
||||
|
||||
def _getAllDisks():
|
||||
|
|
|
@ -215,7 +215,7 @@ def ogCopyFile (src, dst):
|
|||
return
|
||||
|
||||
# Copiar fichero (para evitar problemas de comunicaciones las copias se hacen con rsync en vez de cp).
|
||||
result = subprocess.run(["rsync", "--progress", "--inplace", "-avh", SOURCE, TARGET], text=True) ## they want the output
|
||||
result = subprocess.run(["rsync", "--progress", "--inplace", "-avh", SOURCE, TARGET], text=True)
|
||||
return not result.returncode ## negate shell result
|
||||
|
||||
|
||||
|
|
|
@ -217,15 +217,15 @@ def ogGetMacAddress():
|
|||
#@return str_interface - interfaz de red
|
||||
#@note Usa las variables utilizadas por el initrd "/etc/net-ethX.conf
|
||||
#*/ ##
|
||||
def ogGetNetInterface():
|
||||
if len(sys.argv) >= 2 and sys.argv[1] == "help":
|
||||
SystemLib.ogHelp("ogGetNetInterface", "ogGetNetInterface", "ogGetNetInterface => eth0")
|
||||
return
|
||||
|
||||
if "DEVICE" in os.environ:
|
||||
print(os.environ["DEVICE"])
|
||||
|
||||
return 0
|
||||
#def ogGetNetInterface():
|
||||
# if len(sys.argv) >= 2 and sys.argv[1] == "help":
|
||||
# SystemLib.ogHelp("ogGetNetInterface", "ogGetNetInterface", "ogGetNetInterface => eth0")
|
||||
# return
|
||||
#
|
||||
# if "DEVICE" in os.environ:
|
||||
# print(os.environ["DEVICE"])
|
||||
#
|
||||
# return 0
|
||||
|
||||
#/**
|
||||
# ogGetRepoIp
|
||||
|
@ -277,22 +277,22 @@ def ogGetServerPort():
|
|||
#@note repo = { REPO, CACHE } REPO por defecto
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#*/
|
||||
def ogMakeGroupDir():
|
||||
REPO = ""
|
||||
DIR = ""
|
||||
GROUP = ""
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
SystemLib.ogHelp("ogMakeGroupDir", "ogMakeGroupDir str_repo", "ogMakeGroupDir", "ogMakeGroupDir REPO")
|
||||
return
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
REPO = "REPO"
|
||||
else:
|
||||
REPO = sys.argv[1]
|
||||
|
||||
DIR = FileLib.ogGetPath(REPO, "/groups/" + ogGetGroupName(), stderr=subprocess.DEVNULL)
|
||||
if DIR:
|
||||
subprocess.run(["mkdir", "-p", DIR], stderr=subprocess.DEVNULL)
|
||||
|
||||
return 0
|
||||
#def ogMakeGroupDir():
|
||||
# REPO = ""
|
||||
# DIR = ""
|
||||
# GROUP = ""
|
||||
#
|
||||
# if len(sys.argv) < 2:
|
||||
# SystemLib.ogHelp("ogMakeGroupDir", "ogMakeGroupDir str_repo", "ogMakeGroupDir", "ogMakeGroupDir REPO")
|
||||
# return
|
||||
#
|
||||
# if len(sys.argv) == 1:
|
||||
# REPO = "REPO"
|
||||
# else:
|
||||
# REPO = sys.argv[1]
|
||||
#
|
||||
# DIR = FileLib.ogGetPath(REPO, "/groups/" + ogGetGroupName(), stderr=subprocess.DEVNULL)
|
||||
# if DIR:
|
||||
# subprocess.run(["mkdir", "-p", DIR], stderr=subprocess.DEVNULL)
|
||||
#
|
||||
# return 0
|
||||
|
|
|
@ -500,6 +500,7 @@ def ogNvramSetNext (entry):
|
|||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_GENERIC, f'more than one entry found')
|
||||
return
|
||||
|
||||
SystemLib.ogEcho ([], 'info', f'setting "{numentries[0]}" as next entry in NVRAM')
|
||||
subprocess.run (['efibootmgr', '-n', numentries[0]], capture_output=True, text=True)
|
||||
|
||||
#/**
|
||||
|
|
|
@ -47,7 +47,6 @@ if SystemLib.ogGetCaller() not in ['deployImage', 'restoreImageCustom']:
|
|||
SystemLib.ogEcho (['log', 'session'], None, f'[1] {ogGlobals.lang.MSG_SCRIPTS_START} {prog} ({sys.argv})')
|
||||
|
||||
# Procesar parámetros de entrada
|
||||
print (f'argv ({sys.argv}) len ({len (sys.argv)})')
|
||||
if len (sys.argv) < 5:
|
||||
SystemLib.ogRaiseError ('session', ogGlobals.OG_ERR_FORMAT, f'{ogGlobals.lang.MSG_FORMAT}: {prog} REPO|CACHE imagen ndisco nparticion [ UNICAST|MULTICAST opciones protocolo]')
|
||||
sys.exit (1)
|
||||
|
|
|
@ -37,7 +37,6 @@ import ProtocolLib
|
|||
import FileSystemLib
|
||||
|
||||
prog = os.path.basename (sys.argv[0])
|
||||
print (f'argv ({sys.argv}) len ({len (sys.argv)})')
|
||||
if len (sys.argv) < 3:
|
||||
SystemLib.ogRaiseError ('session', ogGlobals.OG_ERR_FORMAT, f'{ogGlobals.lang.MSG_FORMAT}: {prog} str_REPO _str_Relative_Path_OGIMG_with_/ PROTOCOLO OPCIONES_PROTOCOLO OPCIONES_UPDATECACHE')
|
||||
sys.exit (1)
|
||||
|
|
Loading…
Reference in New Issue