Update: Working on the browser segregations

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2024-06-19 16:04:00 +09:00
parent 8590ed82f6
commit 344b33436e
5 changed files with 153 additions and 85 deletions

View File

@ -41,6 +41,7 @@ def remmove_desktop_files():
"""
os.system('rm /usr/share/applications/btop.desktop')
def install_min_browser():
"""
This minimum browser is used for kumo this will download
@ -53,6 +54,7 @@ def install_min_browser():
)
destination = "/opt"
wget_command = f"wget -P {destination} {url}"
os.system(wget_command)
os.system('dpkg -i /opt/min-1.32.1-amd64.deb')
os.system('apt-get install -f')

View File

@ -124,7 +124,8 @@ class BuildXfce(BuildBase):
""" The helper functions to ensure the xfce requirements are used """
arch_suffix = self.sarch[1:]
cmd_list = None
if self.sbase in ["deb", "dev", "debmin", "devmin", "debsrv", "devsrv", "debld", "devld"]:
if self.sbase in ["deb", "dev", "debmin", "devmin", "debsrv",
"devsrv", "debld", "devld"]:
if arch_suffix in ["64", "32", "arm"]:
os.system(f'touch {self.sbase.upper()}.{arch_suffix}xfc')
if arch_suffix in ["64", "32", "arm"]:
@ -264,7 +265,9 @@ class BuildMini(BuildBase):
"""
arch_suffix = self.sarch[1:]
cmd_list = None
if self.sbase in ["deb", "dev", "debmin", "devmin", "debsrv", "devsrv", "debld", "devld"]:
if self.sbase in ["deb", "dev", "debmin", "devmin", "debsrv",
"devsrv", "debld", "devld"
]:
if arch_suffix in ["64", "32", "arm"]:
os.system(f'touch {self.sbase.upper()}.{arch_suffix}mini')
if arch_suffix in ["64", "32", "arm"]:
@ -350,6 +353,7 @@ class Decisions:
else:
logger.critical("You have not specified a build to process!")
def dgnomefb(self):
""" Arguments for the gnomefb """
build_type_mapping = {
@ -397,7 +401,6 @@ class Decisions:
'b-deb32': ("debld", "_32"),
'b-dev32': ("devld", "_32"),
}
build_argument = self.arguments.b
if build_argument in build_type_mapping:
pass

View File

@ -52,6 +52,8 @@ shared_setup_mini_cmds = ('inflate_bubble.set_fusato_mini_installer_structure',
'infra.mini_shared_installer_files'
)
flag_specific_setup_32_cmds = ('set_specific_32_packages',)
# Setup Desktop configs
# Add mor as needed
setup_xfce_cmds = ('inflate_bubble.set_xfce',
@ -98,7 +100,7 @@ build64_xfce_build = (shared_setup_cmds + setup_xfce_cmds +
build32_xfce_build = (shared_setup_cmds + setup_xfce_cmds +
setup_chroot_grub_32 + setup_binary_grub_32 +
setup_fw_64_32
setup_fw_64_32 + flag_specific_setup_32_cmds
)
buildarm_xfce_build = (shared_setup_cmds + setup_xfce_cmds +
@ -108,12 +110,12 @@ buildarm_xfce_build = (shared_setup_cmds + setup_xfce_cmds +
# Gnome_FlashBack
build64_gfb_build = (shared_setup_cmds + setup_gfb_cmds +
setup_chroot_grub_64 + setup_binary_grub_64 +
setup_fw_64_32
setup_fw_64_32 +
)
build32_gfb_build = (shared_setup_cmds + setup_gfb_cmds +
setup_chroot_grub_32 + setup_binary_grub_32 +
setup_fw_64_32
setup_fw_64_32 + flag_specific_setup_32_cmds
)
buildarm_gfb_build = (shared_setup_cmds + setup_gfb_cmds +
@ -129,7 +131,7 @@ build64_opb_build = (shared_setup_cmds + setup_opb_cmds +
build32_opb_build = (shared_setup_cmds + setup_opb_cmds +
setup_chroot_grub_32 + setup_binary_grub_32 +
setup_fw_64_32
setup_fw_64_32 + flag_specific_setup_32_cmds
)
buildarm_opb_build = (shared_setup_cmds + setup_opb_cmds +
@ -188,7 +190,6 @@ GNOME_FLASHBACK_LIST = ('alacarte\n'
'eog\n'
'evince\n'
'file-roller\n'
#'gdm3\n' # Manuel mentioned not needed.
'gedit\n'
'gnome-calculator\n'
'gnome-control-center\n'
@ -431,9 +432,12 @@ GRUB_LIST_32 = ('efibootmgr\n'
'grub-efi-ia32-bin\n'
'os-prober\n'
'shim-helpers-i386-signed\n'
'luakit\n' # Temp location for the 32bit need
)
# Packages for ONLY 32bit builds for the flagship
FLAG_SPECIFIC_LIST_32=('luakit\n')
# Firmware packages shared by 32 adn 64 bit
FIRMWARE_LIST_32_64 = ('atmel-firmware\n'
'bluez-firmware\n'
@ -615,8 +619,8 @@ LBSET_PRIVATE_MINI_DEV32 = (' --image-name "PeppermintOS-mini-Devuan-32"')
# These are the correct order combined LB commands for the builds by ISO name
# these are used during the pipeline building process.
LBSET_DEB32 = (LBSET_MAIN_SHARED + LBSET_SHARED_32 + LBSET_DEBIAN_SHARED
+ LBSET_PRIVATE_DEB32
LBSET_DEB32 = (LBSET_MAIN_SHARED + LBSET_SHARED_32
+ LBSET_DEBIAN_SHARED + LBSET_PRIVATE_DEB32
)
LBSET_DEB64 = (LBSET_MAIN_SHARED + LBSET_SHARED_64 + LBSET_DEBIAN_SHARED
+ LBSET_PRIVATE_DEB64

View File

@ -61,9 +61,11 @@ def set_fusato_structure():
for f_f in make_packages:
os.makedirs(os.path.join(HOME_FOLDER, PACKAGE_LIST, f_f))
def set_fusato_server_structure():
""" Make some needed folders for the fusato build process.
at the moment you deal with chroot, bootstrap, and includes-installer
at the moment you deal with chroot, bootstrap, and
includes-installer
"""
make_chroot = ['etc/firewalld/zones',
'boot/grub',
@ -84,6 +86,7 @@ def set_fusato_server_structure():
for f_f in make_packages:
os.makedirs(os.path.join(HOME_FOLDER, PACKAGE_LIST, f_f))
def set_fusato_server_installer_structure():
""" Make some needed folders for the fusato build process.
at the moment you deal with the installer
@ -96,10 +99,13 @@ def set_fusato_server_installer_structure():
# Create the directories in includes-installer
for installer_dir in installer_dirs:
full_path = os.path.join(HOME_FOLDER, INCLUDES_INSTALLER, installer_dir.strip('/'))
full_path = os.path.join(HOME_FOLDER, INCLUDES_INSTALLER,
installer_dir.strip('/')
)
os.makedirs(full_path, exist_ok=True)
print(f"Created directory: {full_path}")
def set_fusato_mini_installer_structure():
""" Make some needed folders for the fusato build process.
at the moment you deal with the installer
@ -138,10 +144,13 @@ def set_fusato_mini_installer_structure():
# Create the directories in includes-installer
for installer_dir in installer_dirs:
full_path = os.path.join(HOME_FOLDER, INCLUDES_INSTALLER, installer_dir.strip('/'))
full_path = os.path.join(HOME_FOLDER, INCLUDES_INSTALLER,
installer_dir.strip('/')
)
os.makedirs(full_path, exist_ok=True)
print(f"Created directory: {full_path}")
def set_fusato_installer_structure():
""" Make some needed folders for the fusato build process.
at the moment you deal with chroot and bootstrap
@ -163,54 +172,68 @@ def set_fusato_installer_structure():
return
for f_f in make_chroot:
full_path = os.path.join(HOME_FOLDER, CHROOT_FOLDER.strip('/'), f_f.strip('/'))
full_path = os.path.join(HOME_FOLDER, CHROOT_FOLDER.strip('/'),
f_f.strip('/')
)
try:
os.makedirs(full_path, exist_ok=True)
print(f"Created directory: {full_path}")
except Exception as e:
print(f"Error creating directory {full_path}: {e}")
if __name__ == "__main__":
set_fusato_installer_structure()
## This is not really needed asthif ile is not executed
##if __name__ == "__main__":
## set_fusato_installer_structure()
# Commonly Shared
def make_build_file(base, arch, extension, build_description):
"""
This will get the base, arch, extension, and build, to write the file
This will get the base, arch, extension, and build, to write the
file
"""
file_path = os.path.join(os.path.expanduser(HOME_FOLDER), FUSATO_ROOT,
f'{base}.{arch}{extension}'
)
file_path = os.path.join(os.path.expanduser(HOME_FOLDER),
FUSATO_ROOT, f'{base}.{arch}{extension}'
)
with open(file_path, 'w', encoding='UTF-8') as f_p:
f_p.write(build_description)
def make_bld_xfce(base, arch):
"""Write the xfce build file"""
make_build_file(base, arch, 'xfc', 'XFCE Build')
def make_bld_gnomeflashback(base, arch):
"""Write the gnome fb build file"""
make_build_file(base, arch, 'gfb', 'Gnome Flash Back Build')
def make_bld_openbox(base, arch):
"""Write the openbox build file"""
make_build_file(base, arch, 'opb', 'OpenBox Build')
def make_bld_loaded(base, arch):
"""Write the loaded build file"""
make_build_file(base, arch, 'loaded', 'Loaded Build')
def make_bld_server(base, arch):
"""Write the server build file"""
make_build_file(base, arch, 'server', 'Server Build')
def make_bld_mini(base, arch):
"""Write the mini build file"""
make_build_file(base, arch, 'mini', 'Mini Build')
# Make the shared package lists files
def make_package_list(file_name, content, mode='a'):
"""Create the package list file with the specified content if it doesn't exist."""
"""Create the package list file with the specified content if it
doesn't exist.
"""
file_path = os.path.join(HOME_FOLDER, PACKAGE_LIST, file_name)
if not os.path.exists(file_path):
with open(file_path, mode, encoding='UTF-8') as f_p:
@ -219,82 +242,130 @@ def make_package_list(file_name, content, mode='a'):
else:
print(f"Package list already exists: {file_path}")
def set_general_shared():
""" Create the list for general shared list"""
make_package_list('genshared.list.chroot', conf.GENERAL_SHARED_LIST, mode='x')
make_package_list('genshared.list.chroot',
conf.GENERAL_SHARED_LIST, mode='x'
)
def set_specific_32_packages():
"""Create the list for the 32bit flagship"""
make_package_list('flagspec32.list.chroot',
conf.FLAG_SPECIFIC_LIST_32, mode='x'
)
def set_grub_shared():
""" Create the list for shared grub list"""
make_package_list('grub.list.chroot', conf.GRUB_LIST_SHARED, mode='x')
make_package_list('grub.list.chroot',
conf.GRUB_LIST_SHARED, mode='x'
)
def set_binary_shared():
""" Create the shared list for grub binary"""
make_package_list('installer.list.binary', conf.BINARY_LIST_SHARED, mode='x')
make_package_list('installer.list.binary',
conf.BINARY_LIST_SHARED, mode='x'
)
# Light DM package list login window
def set_lightdm():
""" Create the list for the light dm list """
make_package_list('lightdm.list.chroot', conf.LIGHT_DM_LIST, mode='x')
make_package_list('lightdm.list.chroot',
conf.LIGHT_DM_LIST, mode='x'
)
# Desktop Environments
def set_xfce():
""" Create the list for the xfce xfce list"""
make_package_list('xfce.list.chroot', conf.XFCE_LIST, mode='x')
make_package_list('xfce.list.chroot',
conf.XFCE_LIST, mode='x'
)
def set_gfb():
""" Create the list for the gnomeflashback list"""
make_package_list('gfb.list.chroot', conf.GNOME_FLASHBACK_LIST, mode='x')
make_package_list('gfb.list.chroot',
conf.GNOME_FLASHBACK_LIST, mode='x'
)
def set_opb():
""" Create the list for the openbox list"""
make_package_list('opb.list.chroot', conf.OPENBOX_LIST, mode='x')
make_package_list('opb.list.chroot',
conf.OPENBOX_LIST, mode='x'
)
def set_loaded():
""" Create the list for the loaded list"""
make_package_list('loaded.list.chroot', conf.LOADED_LIST, mode='x')
make_package_list('loaded.list.chroot',
conf.LOADED_LIST, mode='x'
)
# Server Specific
def set_server():
""" Create the list for the server list"""
make_package_list('server.list.chroot', conf.SERVER_LIST, mode='x')
make_package_list('server.list.chroot',
conf.SERVER_LIST, mode='x'
)
# Mini Specific
def set_mini():
""" Create the list for the loaded list"""
make_package_list('mini.list.chroot', conf.MINI_LIST, mode='x')
make_package_list('mini.list.chroot',
conf.MINI_LIST, mode='x'
)
# CHROOT Specific
def set_chroot_grub_64():
""" Append the grub list for 64 bit grub"""
make_package_list('gfb.list.chroot', conf.GRUB_LIST_64)
def set_chroot_grub_arm():
""" Append the grub list for the ARM grub"""
make_package_list('gfb.list.chroot', conf.GRUB_LIST_ARM64)
def set_chroot_grub_32():
""" Append the grub list for the 32 bit grub"""
make_package_list('gfb.list.chroot', conf.GRUB_LIST_32)
# Binary Specific
def set_binary_64():
""" Create the list for grub binary packages for 64 bit"""
make_package_list('installer.list.binary', conf.BINARY_LIST_64)
def set_binary_arm():
""" Create the list for grub binary packages for 64 bit"""
make_package_list('installer.list.binary', conf.BINARY_LIST_ARM)
def set_binary_32():
""" Create the list for grub binary packages for 32 bit"""
make_package_list('installer.list.binary', conf.BINARY_LIST_32)
# Firmware Specific
def set_firmware():
""" Create the list for the firmware support for general ISOs"""
make_package_list('firmware.list.chroot', conf.FIRMWARE_LIST_32_64, mode='x')
make_package_list('firmware.list.chroot',
conf.FIRMWARE_LIST_32_64, mode='x'
)
def set_firmware_arm():
""" Create the list for the firmware support for arm ISOs"""
make_package_list('firmware.list.chroot', conf.FIRMWARE_LIST_ARM, mode='x')
make_package_list('firmware.list.chroot',
conf.FIRMWARE_LIST_ARM, mode='x'
)

View File

@ -62,14 +62,12 @@ class ChrootInstallerFiles:
Copies all installer folders to CHROOT depending on the base.
"""
ALLOWED_BASES = {"deb", "dev", "debld", "devld"}
def __init__(self, base, sarch=None):
self.base = base
self.sarch = sarch
if self.base not in self.ALLOWED_BASES:
logger.warning(f"Base '{self.base}' is not allowed. Skipping.")
return
logger.info(f"Copy Installer Files for base: {self.base}")
calamares_path = '/calamares_settings/'
self.src_paths = (
@ -102,11 +100,11 @@ class ChrootInstallerFiles:
'/usr/share/glib-2.0/schemas/',
'/usr/share/applications/'
)
self.copy_files()
def copy_files(self):
# Ensure destination directories exist before copying
""" Ensure destination directories exist before copying"""
for des in self.des_paths:
full_des_path = os.path.join(HOME_FOLDER, WPCHROOT.strip('/'), des.strip('/'))
try:
@ -114,23 +112,25 @@ class ChrootInstallerFiles:
logger.info(f"Ensured directory exists: {full_des_path}")
except Exception as e:
logger.error(f"Error creating directory {full_des_path}: {e}")
# Copy files and directories to their CHROOT locations
src_q = collections.deque(self.src_paths)
des_q = collections.deque(self.des_paths)
size_q = len(src_q)
for _ in range(size_q):
source = src_q.popleft()
des = des_q.popleft()
full_src_path = os.path.join(HOME_FOLDER, source.strip('/'))
full_des_path = os.path.join(HOME_FOLDER, WPCHROOT.strip('/'), des.strip('/'))
full_des_path = os.path.join(HOME_FOLDER,
WPCHROOT.strip('/'), des.strip('/')
)
logger.info(MSG_COPY + full_src_path)
try:
if os.path.exists(full_src_path):
if os.path.isdir(full_src_path):
shutil.copytree(full_src_path, os.path.join(full_des_path, os.path.basename(full_src_path)), dirs_exist_ok=True)
shutil.copytree(full_src_path,
os.path.join(full_des_path,
os.path.basename(full_src_path)),
dirs_exist_ok=True
)
else:
shutil.copy(full_src_path, full_des_path)
logger.info(MSG_FIN + full_des_path)
@ -138,18 +138,17 @@ class ChrootInstallerFiles:
logger.error(f"Source path does not exist: {full_src_path}")
except Exception as e:
logger.error(f"Error copying {full_src_path} to {full_des_path}: {e}")
@classmethod
def run_for_all_bases(cls):
# Define the bases to be used
""" Define the bases to be used"""
bases = ["deb", "dev", "debld", "devld", "invalid_base"]
for base in bases:
cls(base)
# Execute the copy for all bases
if __name__ == "__main__":
ChrootInstallerFiles.run_for_all_bases()
#### This section is not really needed since this file is never executed
#### outright so I commented this
#if __name__ == "__main__": ## This seems incorrect, I am testing
# ChrootInstallerFiles.run_for_all_bases()
class BinaryFolders:
@ -158,7 +157,6 @@ class BinaryFolders:
the architecture it will, copy folders as needed
"""
def __init__(self, sbase, sarch):
logger.info("Copy Binary")
self.sbase = sbase
self.sarch = sarch
@ -260,12 +258,9 @@ def mini_shared_installer_files():
This function will get the files that are shared commonly amongst
all mini builds,
"""
logger.info("Copy mini installer files")
src_paths = ('/installer/keyrings/',
'/installer/applications/',
#'/database/',
'/PepProPixMaps/',
'/pmostools/',
'/PepProTools/',
@ -282,7 +277,6 @@ def mini_shared_installer_files():
)
des_paths =('/preseed/keyrings/',
'/preseed/apps/',
#'/preseed/database/',
'/preseed/pixmaps/',
'/preseed/tools/',
'/preseed/protools/',
@ -297,15 +291,16 @@ def mini_shared_installer_files():
'/preseed/lightdm/',
'/preseed/autostart/'
)
# copy files to thier INSTALLER Location
for src, des in zip(src_paths, des_paths):
src_path = HOME_FOLDER + src
des_path = HOME_FOLDER + WPINSTALLER + des
if os.path.isdir(src_path): # Check if the source path is a directory.
if os.path.isdir(src_path):
for root, dirs, files in os.walk(src_path):
for file in files:
source_file = os.path.join(root, file)
dest_file = os.path.join(des_path, os.path.relpath(source_file, src_path))
dest_file = os.path.join(des_path,
os.path.relpath(source_file, src_path)
)
logger.info(f"Copying {source_file} to {dest_file}")
shutil.copy(source_file, dest_file)
logger.info(f"Copy completed: {dest_file}")
@ -320,10 +315,8 @@ class ArchitectureFiles:
Copy all the needed files and folders to CHROOT. Depending on the
architecture, it will copy files and folders as needed.
"""
def __init__(self, sbase, sarch, force_copy=False):
self.force_copy = force_copy
logger.info("Copy Architecture")
self.sbase = sbase
self.sarch = sarch
@ -343,8 +336,6 @@ class ArchitectureFiles:
'/etc/default',
'/boot/grub/themes'
)
# copy files and folders to their CHROOT Location
src_q = collections.deque(src_paths)
des_q = collections.deque(des_paths)
size_q = len(src_q)
@ -353,11 +344,9 @@ class ArchitectureFiles:
des = des_q.popleft()
src_path = HOME_FOLDER + source
des_path = 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):
@ -370,13 +359,25 @@ class ArchitectureFiles:
logger.info(f"Successfully copied {src_path} to {des_path}")
def get_id_build_type():
"""
This will get the type of build that is taking place
"""
source_folder = '/home/pepadmin/start/bldtype'
dest_folder = '/home/pepadmin/bubbles/fusato/chroot/opt/pepconf'
for filename in os.listdir(source_folder):
src_file = os.path.join(source_folder, filename)
dest_file = os.path.join(dest_folder, filename)
if os.path.isfile(src_file):
shutil.copy(src_file, dest_file)
print(f'Copied: {src_file} to {dest_file}')
def set_symlinks():
"""
Set the symliknks that are used for all builds.
"""
logger.info("Copy Symlinks")
pep_info = '/usr/share/python-apt/templates/Peppermint.info'
pep_mirror = '/usr/share/python-apt/templates/Peppermint.mirrors'
pep_csv = '/usr/share/distro-info/peppermint.csv'
@ -396,9 +397,7 @@ def shared_folders():
This function will get the files that are shared commonly amongst
all the builds,
"""
logger.info("Copy Shared folders")
src_paths = ('/plymouth/joy',
'/application',
'/font',
@ -443,6 +442,8 @@ def shared_folders():
dirs_exist_ok = True
)
logger.info(MSG_FIN + HOME_FOLDER + WPCHROOT + des)
# After get the maine files lets get the build type taking place
get_id_build_type()
def icons_themes():
@ -494,8 +495,6 @@ def icons_themes():
src_q = collections.deque(src_paths)
des_q = collections.deque(des_paths)
size_q = len(src_q)
for size_length in range(size_q):
source = src_q.popleft()
des = des_q.popleft()
@ -512,9 +511,7 @@ def shared_files():
This will copy all specific files that a used for all
builds.
"""
logger.info("Copy Shared Files")
src_paths = ('/aliases/bash_aliases',
'/sources/peppermint.list',
'/PepProTools/xDaily',
@ -539,7 +536,6 @@ def shared_files():
'/etc/lightdm/lightdm-gtk-greeter.conf',
'/etc/plymouth/plymouthd.conf',
)
# copy files to thier CHROOT Location
src_q = collections.deque(src_paths)
des_q = collections.deque(des_paths)
size_q = len(src_q)
@ -558,9 +554,7 @@ def shared_server_files():
This silll copy all specific files that a used for the server
builds.
"""
logger.info("Copy Shared Files")
src_paths = ('/server/firewall/public.xml',
)
des_paths = ('/etc/firewalld/zones',
@ -583,9 +577,7 @@ def boostrap_shared():
"""
Copy specific folders in the boostrap location
"""
logger.info("Copy Shared BootStrap")
src_paths = ('/issue',)
des_paths = ('/etc',)
src_q = collections.deque(src_paths)
@ -606,9 +598,7 @@ def xfce_configs():
"""
Copy the xfce files.
"""
logger.info("Copy xfce4 configs")
src_xfce = '/xfce/xfce4'
des_xfce = '/etc/skel/.config/xfce4'
logger.info(MSG_COPY + HOME_FOLDER + src_xfce)
@ -631,7 +621,6 @@ def gnome_flahsbak_configs():
"""
Copy the gnome flashback files
"""
logger.info("Copy Gnome Flashback configs")
src_gnomef = '/gnome-flashback'
des_gnomef = '/etc/skel/'
@ -647,7 +636,6 @@ def open_box_configs():
"""
Copy the openbox files
"""
logger.info("Copy openbox configs")
src_ob = '/openbox'
des_ob = '/etc/skel/'
@ -662,8 +650,7 @@ def open_box_configs():
def loaded_configs():
"""
Copy the loaded xfce files
"""#
"""
logger.info("Copy loaded xfce configs")
src_loaded = '/loaded/xfce'
des_loaded = '/etc/skel/.config/'
@ -705,8 +692,7 @@ def loaded_folders():
def server_configs():
"""
Copy the server files
"""#
"""
logger.info("Copy server configs")
src_server = '/server/configs'
des_server = '/etc/skel/.config/'
@ -717,3 +703,5 @@ def server_configs():
)
logger.info(MSG_FIN + HOME_FOLDER + WPCHROOT + des_server)