emprove the iso building and some cleanup

This commit is contained in:
manuel 2024-05-26 17:34:18 +00:00
parent f80616eefa
commit 412189ca0d
4 changed files with 55 additions and 82 deletions

View File

@ -135,7 +135,7 @@ def setting_permissions():
os.system('chmod 755 /usr/share/applications/Welcome.desktop') os.system('chmod 755 /usr/share/applications/Welcome.desktop')
os.system('chmod 755 /usr/share/applications/plank.desktop') os.system('chmod 755 /usr/share/applications/plank.desktop')
os.system('chmod 755 /usr/share/applications/kumo.desktop') os.system('chmod 755 /usr/share/applications/kumo.desktop')
os.system('chmod 755 /usr/share/applications/Install-peppermint.desktop') os.system('chmod 755 /usr/share/applications/calamares-install-peppermint.desktop')
# Executables # Executables
os.system('chmod 755 /usr/local/bin/xDaily') os.system('chmod 755 /usr/local/bin/xDaily')
os.system('chmod 755 /usr/local/bin/kumo') os.system('chmod 755 /usr/local/bin/kumo')

View File

@ -69,10 +69,9 @@ class BuildBase:
def infra_helper(self): def infra_helper(self):
""" Get the build infrastucture ready """ """ Get the build infrastucture ready """
infra_methods = [infra.ChrootFolders, infra.BinaryFolders, infra_methods = [infra.BinaryFolders, infra.ChrootInstallerFiles,
infra.ArchitectureFiles, infra.Archive, infra.ArchitectureFiles, infra.Archive,
infra.InstallerFiles, infra.FusatoConfigs, infra.InstallerFiles, infra.FusatoConfigs,
infra.ChrootInstallerFiles,
] ]
for method in infra_methods: for method in infra_methods:
method(self.sbase, self.sarch) method(self.sbase, self.sarch)

View File

@ -326,6 +326,7 @@ LIGHT_DM_LIST = ('lightdm\n'
GENERAL_SHARED_LIST = ('alsa-utils\n' GENERAL_SHARED_LIST = ('alsa-utils\n'
'bluez\n' 'bluez\n'
'calamares\n' 'calamares\n'
'calamares-settings-debian\n'
'console-setup\n' 'console-setup\n'
'cups\n' 'cups\n'
'curl\n' 'curl\n'

View File

@ -56,48 +56,6 @@ class Archive:
) )
logger.info(MSG_FIN + HOME_FOLDER + FUSATOCONFIG + des) logger.info(MSG_FIN + HOME_FOLDER + FUSATOCONFIG + des)
class ChrootFolders:
"""
Copy all the needed folders to CHROOT Depending on
the architecture it will, copy folders as needed
"""
# It would be better to move the calamares and /opt/pepconf files
# to a def or other solution since they are not necessary in server
# builds.
# Mini builds are not affected because the chroot is deleted in the
# binary phase.
def __init__(self,sbase,sarch):
logger.info("Copy Chroot")
self.sbase = sbase
self.sarch = sarch
src_chroot = ('/osrelease/' + self.sbase + self.sarch,
'/osrelease/' + self.sbase + self.sarch,
'/grub/'+ self.sbase + self.sarch,
#'/calamares_settings/' + self.sbase + self.sarch +
#'/calamares/modules',
'/grub/' + self.sbase + '_themes'
)
des_chroot =('/usr/lib',
'/opt/pepconf',
'/etc/default',
#'/etc/calamares/modules',
'/boot/grub/themes'
)
# Chroot Folders.
chroot_src_q = collections.deque(src_chroot)
chroot_des_q = collections.deque(des_chroot)
chroot_size_q = len(chroot_src_q)
for size_length in range(chroot_size_q):
source = chroot_src_q.popleft()
des = chroot_des_q.popleft()
logger.info(MSG_COPY + HOME_FOLDER + source)
shutil.copytree(HOME_FOLDER + source,
HOME_FOLDER + WPCHROOT + des,
dirs_exist_ok = True
)
logger.info(MSG_FIN + HOME_FOLDER + WPCHROOT + des)
class ChrootInstallerFiles: class ChrootInstallerFiles:
""" """
Copies all installer folders to CHROOT depending on the base. Copies all installer folders to CHROOT depending on the base.
@ -301,25 +259,35 @@ def mini_shared_installer_files():
src_paths = ('/installer/keyrings/', src_paths = ('/installer/keyrings/',
'/installer/applications/', '/installer/applications/',
'/database/', #'/database/',
'/PepProPixMaps/', '/PepProPixMaps/',
'/pmostools/', '/pmostools/',
'/PepProTools/', '/PepProTools/',
'/polkit/', '/polkit/',
'/issue/', '/issue/',
'/pylibraries/', '/pylibraries/requests/',
'/pylibraries/tendo/',
'/pylibraries/tendo-0.3.0.dist-info/',
'/pylibraries/ttkbootstrap/',
'/pylibraries/ttkbootstrap-1.10.1.dist-info/',
'/pylibraries/ttkcreator/',
'/lightdm/', '/lightdm/',
'/autostart' '/autostart'
) )
des_paths =('/preseed/keyrings/', des_paths =('/preseed/keyrings/',
'/preseed/apps/', '/preseed/apps/',
'/preseed/database/', #'/preseed/database/',
'/preseed/pixmaps/', '/preseed/pixmaps/',
'/preseed/tools/', '/preseed/tools/',
'/preseed/protools/', '/preseed/protools/',
'/preseed/polkit/', '/preseed/polkit/',
'/preseed/conf/', '/preseed/conf/',
'/preseed/py/', '/preseed/py/requests/',
'/preseed/py/tendo/',
'/preseed/py/tendo-0.3.0.dist-info/',
'/preseed/py/ttkbootstrap/',
'/preseed/py/ttkbootstrap-1.10.1.dist-info/',
'/preseed/py/ttkcreator/',
'/preseed/lightdm/', '/preseed/lightdm/',
'/preseed/autostart/' '/preseed/autostart/'
) )
@ -343,53 +311,57 @@ def mini_shared_installer_files():
class ArchitectureFiles: class ArchitectureFiles:
""" """
Copy all the needed files to CHROOT Depending on the Copy all the needed files and folders to CHROOT. Depending on the
architecture it will, copy files as needed architecture, it will copy files and folders as needed.
""" """
def __init__(self, sbase, sarch): def __init__(self, sbase, sarch, force_copy=False):
self.force_copy = force_copy
logger.info("Copy Architecture") logger.info("Copy Architecture")
self.sbase = sbase self.sbase = sbase
self.sarch = sarch self.sarch = sarch
calamares_path = '/calamares_settings/'
sources_path = '/sources/' sources_path = '/sources/'
src_paths = (#calamares_path + self.sbase + self.sarch + # All of the calamares files are copied in the ChrootInstallerFiles class maybe this shold be deleted src_paths = (sources_path + self.sbase + self.sarch +
#'/calamares/settings.conf',
#calamares_path + self.sbase + self.sarch +
#'/install-peppermint',
#calamares_path + self.sbase + self.sarch +
#'/sources-final',
#calamares_path + self.sbase + self.sarch +
#'/bootloader-config',
#calamares_path +
#'adddesktopicon/add-calamares-desktop-icon',
sources_path + self.sbase + self.sarch +
'/sources.list', '/sources.list',
'/id_files/pep_id' '/id_files/pep_id',
'/osrelease/' + self.sbase + self.sarch,
'/osrelease/' + self.sbase + self.sarch,
'/grub/'+ self.sbase + self.sarch,
'/grub/' + self.sbase + '_themes'
) )
des_paths = (#'/etc/calamares/settings.conf', des_paths = ('/opt/pepconf/sources.list',
#'/usr/bin/install-peppermint', '/usr/share/peppermint/pep_id',
#'/usr/sbin/sources-final', '/usr/lib',
#'/usr/sbin/bootloader-config', '/opt/pepconf',
#'/usr/bin/add-calamares-desktop-icon', '/boot/grub',
'/opt/pepconf/sources.list', '/boot/grub/themes'
'/usr/share/peppermint/pep_id'
) )
# copy files to thier CHROOT Location
# copy files and folders to their CHROOT Location
src_q = collections.deque(src_paths) src_q = collections.deque(src_paths)
des_q = collections.deque(des_paths) des_q = collections.deque(des_paths)
size_q = len(src_q) size_q = len(src_q)
for size_length in range(size_q): for size_length in range(size_q):
source = src_q.popleft() source = src_q.popleft()
des = des_q.popleft() des = des_q.popleft()
logger.info(MSG_COPY+ HOME_FOLDER + source) src_path = HOME_FOLDER + source
shutil.copy(HOME_FOLDER + source, des_path = HOME_FOLDER + WPCHROOT + des
HOME_FOLDER + WPCHROOT + des
)
logger.info(MSG_FIN + HOME_FOLDER + WPCHROOT + des)
if os.path.exists(des_path) and not self.force_copy:
logger.info(f"Skipping {src_path} as it already exists at {des_path}")
continue
logger.info(f"Copying {src_path} to {des_path}")
try:
if os.path.isdir(src_path):
shutil.copytree(src_path, des_path, ignore_dangling_symlinks=True)
else:
shutil.copy2(src_path, des_path)
except Exception as e:
logger.error(f"Error copying {src_path} to {des_path}: {e}")
else:
logger.info(f"Successfully copied {src_path} to {des_path}")
def set_symlinks(): def set_symlinks():
""" """
@ -547,6 +519,7 @@ def shared_files():
'/plymouth/plymouthd.conf', '/plymouth/plymouthd.conf',
#'/packages/deb-multimedia-keyring_2016.8.1_all.deb', #'/packages/deb-multimedia-keyring_2016.8.1_all.deb',
# '/repo_public_key/trusted.gpg', # '/repo_public_key/trusted.gpg',
) )
des_paths = ('/etc/skel/.bash_aliases', des_paths = ('/etc/skel/.bash_aliases',
'/etc/apt/sources.list.d', '/etc/apt/sources.list.d',