refs #596 add config file, install more packages per the config

pull/1/head
Natalia Serrano 2024-08-12 14:58:08 +02:00
parent 2729431ad1
commit 3fffd212da
4 changed files with 85 additions and 33 deletions

View File

@ -4,9 +4,13 @@ import argparse
import os
import re
import subprocess
import configparser
from boottoolsfunctions import _run
config = configparser.ConfigParser (inline_comment_prefixes='#')
config.read ('boottoolsgenerator.cfg')
debconf_settings = """
kexec-tools kexec-tools/load_kexec boolean true
openssh-server openssh-server/permit-root-login boolean true
@ -14,22 +18,22 @@ refind refind/install_to_esp boolean false
""".strip()
def _aptget_clean():
subprocess.run (['apt-get', 'clean'])
_run (['apt-get', 'clean'])
def _aptget_autoclean():
subprocess.run (['apt-get', 'autoclean'])
_run (['apt-get', 'autoclean'])
def _aptget_autoremove():
subprocess.run (['apt-get', 'autoremove'])
_run (['apt-get', 'autoremove'])
def _aptget_update():
subprocess.run (['apt-get', 'update'])
_run (['apt-get', 'update'])
def _aptget_upgrade():
subprocess.run (['apt-get', 'upgrade', '--yes'])
_run (['apt-get', 'upgrade', '--yes'])
def _aptget_install (pkgs, opts=[]):
subprocess.run (['apt-get', '--yes'] + opts + ['install'] + pkgs)
_run (['apt-get', '--yes'] + opts + ['install'] + pkgs)
def _oghook_deactivate():
#Desactivamos el hook del oginitrd.img para evitar problemas, al final de este escripts se activará
@ -57,7 +61,7 @@ def boottoolsSoftwareInstall (osarch, osrelease):
stdout, _ = _run (['dpkg-divert', '--list'])
if not re.findall (r'local diversion of /sbin/initctl to /sbin/initctl.distrib', stdout):
subprocess.run (['dpkg-divert', '--local', '--rename', '--add', '/sbin/initctl'])
_run (['dpkg-divert', '--local', '--rename', '--add', '/sbin/initctl'])
os.symlink ('/bin/true', '/sbin/initctl')
#TEST desactivamos upstart
@ -66,17 +70,10 @@ def boottoolsSoftwareInstall (osarch, osrelease):
_aptget_clean()
pkgs32 = []
if 'i386' != osarch:
subprocess.run (['dpkg', '--add-architecture', 'i386'])
_run (['dpkg', '--add-architecture', 'i386'])
pkgs32 = 'lib32gcc-s1 lib32stdc++6 lib32z1 libc6-i386'.split (' ') ## he cambiado lib32gcc1 por lib32gcc-s1 pero como queramos crear un oglive viejo, esto va a petar
_aptget_update() ## esto ya esta hecho...
#Ign:13 http://ppa.launchpad.net/zfs-native/stable/ubuntu noble InRelease
#Err:15 http://ppa.launchpad.net/zfs-native/stable/ubuntu noble Release
# 404 Not Found [IP: 185.125.190.80 80]
#
#E: The repository 'http://ppa.launchpad.net/zfs-native/stable/ubuntu noble Release' does not have a Release file.
#N: Updating from such a repository can't be done securely, and is therefore disabled by default.
#N: See apt-secure(8) manpage for repository creation and user configuration details.
_oghook_deactivate()
_aptget_upgrade()
_mock_mtab()
@ -89,21 +86,13 @@ def boottoolsSoftwareInstall (osarch, osrelease):
## nati: hace falta --force-confdef para evitar un tema interactivo del /etc/ssh/ssh_config
_aptget_install (['sshfs', 'kexec-tools'] + pkgs32, opts=['-o', 'DPkg::Options::=--force-confdef'])
"""
#comenzamos con la instalación de los paquetes a instalar.
to_install = {}
for group in `find /usr/bin/boot-tools/listpackages/ -name sw.*`; do
echo "Instalando el grupo de paquetes almacenados en $group"
for package in ` awk /^install/'{print $2}' $group `; do
echo -n $package' ' >&2
to_install[package] = 1
done
echo >&2
done
del to_install['refind'] ## nati: este paquete no existe y toda la invocación de apt se muere (no sé cómo hacer que apt ignore los paquetes que no existen)
echo =========================================== nati pkgs to install ${!TO_INSTALL[*]}
_aptget_install (list (to_install.keys()))
pkgs = []
for section in config.options('Packages'):
pkgs += re.split (r'[ \n]', config['Packages'].get(section).strip())
print ('about to install these packages: "{}"'.format (' '.join (pkgs)))
_aptget_install (pkgs)
"""
# Instalar módulos que algunos paquetes puedan tener pendientes de compilar.
echo "Instalando módulos adicionales con DKMS"
while read -e mod vers; do

View File

@ -30,7 +30,7 @@ def _is_mounted (mntpt):
def _umount (mntpt):
if (_is_mounted (mntpt)):
subprocess.run (['umount', mntpt])
_run (['umount', mntpt])
def btogGetVar (osarch):
btdir = '/tmp/opengnsys_installer/opengnsys/client/boot-tools'
@ -209,7 +209,7 @@ def btogSetFsVirtual (btrootfsimg, btrootfsimglabel, btrootfsmnt, btvirtualdisks
raise Exception ('no diskloop')
logger.debug ('losetup attach')
try: _run (['losetup', diskloop, btrootfsimg])
try: _run (['losetup', '--partscan', diskloop, btrootfsimg])
except: raise Exception ('losetup failed')
logger.info ('Partitioning disk image')
@ -304,7 +304,7 @@ def btogSetFsBase (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp):
try: _run (['debootstrap', '--arch={}'.format(osarch), '--components=main,universe', oscodename, btrootfsmnt, oshttp])
except:
if (_is_mounted (btrootfsmnt)):
subprocess.run (['umount', btrootfsmnt])
_run (['umount', btrootfsmnt])
raise Exception ('debootstrap --arch="{}" --components=main,universe "{}" "{}" "{}" : ha fallado!'.format (osarch, oscodename, btrootfsmnt, oshttp))
logger.info ('debootstrap --arch="{}" --components=main,universe "{}" "{}" "{}" : ok'.format (osarch, oscodename, btrootfsmnt, oshttp))

View File

@ -0,0 +1,58 @@
[Packages]
basic =
dialog man-db fbset gdebi-core bash-static busybox-static locales lshw gawk git python-openssl python php-cli dmidecode rpm sqlite3 os-prober moreutils jq
#console-data # ogLive anterior a Ubuntu 20.04
#subversion # ogLive anterior a Ubuntu 18.04
#php5-cli # ogLive anterior a Ubuntu 16.04
#realpath # ogLive hasta Ubuntu 16.04
#zypper # PROBAR
cloning = fsarchiver pv pxe-kexec mbuffer parted gdisk chntpw clonezilla registry-tools reglookup libparse-win32registry-perl libwin-hivex-perl grokevt libhivex0 libhivex-bin rsync
compile =
build-essential libattr1 libattr1-dev uuid-dev attr make m4 gettext libmhash-dev
#libattr* # Satura el tamaño del archivo en Ubuntu 15.04
compressor = lzma zip unzip gzip lzop pigz pbzip2 lbzip2 rzip p7zip-full
filesystem_local =
squashfs-tools unionfs-fuse ntfs-3g dosfstools fatresize exfat-utils dmraid dmsetup lvm2 e2fsprogs
jfsutils reiserfsprogs reiser4progs xfsprogs mhddfs hfsplus hfsprogs hfsutils nilfs-tools vmfs-tools
btrfs-progs # ogLive a partir de Ubuntu 20.04
zfsutils-linux # ogLive a partir de Ubuntu 16.04
android-tools-adb # ogLive a partir de Ubuntu 16.04
android-tools-fastboot # ogLive a partir de Ubuntu 16.04
f2fs-tools
#drbl-ntfsprogs # Eliminado
#ntfs-config # ogLive anterior a Ubuntu 20.04
#btrfs-tools # ogLive anterior a Ubuntu 20.04
#ufsutils # ogLive anterior a Ubuntu 14.04
#zfsutils # ogLive anterior a Ubuntu 16.04
#android-tools-fsutils # ogLive entre Ubuntu 16.04 y Ubuntu 20.04
filesystem_remote =
sshfs cifs-utils smbclient open-iscsi openssh-server
#nfs-common # Provoca error de instalación en Ubuntu 15.04
#bittornado # ogLive anterior a Ubuntu 20.04
monitoring = htop ncdu bwbar bmon iftop ifstat dstat hdparm sdparm blktool testdisk
networking = netpipes curl wget tftp dnsutils trickle lighttpd ethtool ssmping tcpdump nmap arping ntpdate ctorrent udpcast #iptraf
testing =
screen schroot xmlstarlet
efibootmgr efitools refind grub-efi-amd64-bin grub-efi-ia32-bin grub-pc-bin ## UEFI
#libxss1 python-prctl python-six python-requests ## OGAgent
##############
fusioninventory-agent nvme-cli disktype laptop-detect
#discover casper lupin-casper xinit obconf xserver-xorg x11-xserver-utils xterm network-manager-gnome plymouth-x11 plymouth-label plymouth-theme-ubuntu-logo pcmanfm chromium-browser gtk-theme-switch gtk2-engines murrine-themes
####################################3
#gnome-icon-theme gnome-brave-icon-theme dmz-cursor-theme python-wnck python-xlib python-pyinotify python-alsaaudio python-vte maximus gpicview leafpad lxappearance lxmenu-data lxrandr lxterminal nitrogen ttf-ubuntu-font-family time synaptic libglib-perl libgtk2-perl libxml-simple-perl smartmontools gnome-disk-utility policykit-1-gnome policykit-desktop-privileges baobab lshw-gtk usb-creator-gtk wodim curlftpfs libnotify-bin cryptsetup system-config-lvm
xwindows =
v86d # VESA Kernel 3.7+
#xorg-dev xorg lxde #+300M
#roxterm gparted #+80M
#openbox midori #xvesa en compilacion

View File

@ -6,6 +6,7 @@ import logging
import subprocess
import glob
import stat
import configparser
curdir = os.path.dirname (__file__)
sys.path.insert (0, curdir)
@ -14,9 +15,13 @@ from boottoolsfunctions import _run, _is_mounted, btogGetOsInfo1, btogGetOsInfo2
logging.basicConfig (filename='/tmp/boot-tools_installation.log', filemode='a', format='%(levelname)s %(asctime)s (%(funcName)s) %(message)s', level=logging.INFO)
logger = logging.getLogger ('boottools')
#config = configparser.ConfigParser()
#config.read ('boottoolsgenerator.cfg')
if not os.path.exists ('/tmp/opengnsys_installer/opengnsys/client/engine'):
branch = 'main'
tmpdir = subprocess.run (['mktemp', '--tmpdir', '--directory', 'oggit.XXXXXX']).stdout.decode ('utf-8').strip()
tmpdir, _ = _run (['mktemp', '--tmpdir', '--directory', 'oggit.XXXXXX'])
logger.debug ('tmpdir "{}"'.format(tmpdir))
_run (['git', 'clone', '-c', 'http.sslVerify=false', '--branch', branch, 'https://ognproject.evlt.uma.es/gitea/opengnsys/opengnsys.git', tmpdir])
_run (['rsync', '-aH', '{}/client/engine'.format(tmpdir), '{}/client/shared'.format(tmpdir), '/tmp/opengnsys_installer/opengnsys/client/'])
_run (['rm', '-rf', tmpdir])