From 9d44d90d880172ecfd7ac2f27aa21d0aa7463a95 Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 22 Sep 2024 16:22:05 +0000 Subject: [PATCH] merge git repos --- python_modules/build_iso.py | 1 + python_modules/conf.py | 213 ++++++++++++++----------------- python_modules/finish_cleanup.py | 5 - python_modules/fresh_bubble.py | 12 -- python_modules/inflate_bubble.py | 8 +- python_modules/infra.py | 90 +++++++++++++ 6 files changed, 190 insertions(+), 139 deletions(-) diff --git a/python_modules/build_iso.py b/python_modules/build_iso.py index b8497fed..7bbda38a 100644 --- a/python_modules/build_iso.py +++ b/python_modules/build_iso.py @@ -76,6 +76,7 @@ class BuildBase: infra_methods = [infra.BinaryFolders, infra.ChrootInstallerFiles, infra.ArchitectureFiles, infra.Archive, infra.InstallerFiles, infra.FusatoConfigs, + infra.ServerConfigFiles, ] for method in infra_methods: method(self.sbase, self.sarch) diff --git a/python_modules/conf.py b/python_modules/conf.py index 01c5a03b..e9fab7ea 100644 --- a/python_modules/conf.py +++ b/python_modules/conf.py @@ -1,4 +1,3 @@ -<<<<<<< HEAD """ * Author: "PeppermintOS Team(peppermintosteam@proton.me) * @@ -8,16 +7,15 @@ * and desktop as the need to scale the builds arises, you can add more * settings to meet the need. """ -======= + import paths import inflate_bubble import finish_cleanup import copy_folders import copy_files_specified ->>>>>>> 6dd24574 (Updated) ######################################### -# Sepcify the build to use, for exmaple # +# Sepecify the build to use, for exmaple # # bookworm, trixie etc... # ######################################### debian_codename ='bookworm' @@ -42,34 +40,28 @@ shared_setup_cmds = ('inflate_bubble.set_fusato_structure', 'infra.add_web_profile' ) -shared_setup_loaded_cmds = ( - 'inflate_bubble.set_fusato_structure', - 'inflate_bubble.set_fusato_installer_structure', - 'inflate_bubble.set_general_shared', - 'inflate_bubble.set_grub_shared', - 'inflate_bubble.set_binary_shared', - 'inflate_bubble.set_lightdm', - 'infra.shared_folders', - 'infra.icons_themes', - 'infra.shared_files', - 'infra.set_symlinks', - 'infra.boostrap_shared' +shared_setup_loaded_cmds = ('inflate_bubble.set_fusato_structure', + 'inflate_bubble.set_fusato_installer_structure', + 'inflate_bubble.set_general_shared', + 'inflate_bubble.set_grub_shared', + 'inflate_bubble.set_binary_shared', + 'inflate_bubble.set_lightdm', + 'infra.shared_folders', + 'infra.icons_themes', + 'infra.shared_files', + 'infra.set_symlinks', + 'infra.boostrap_shared' ) -shared_setup_server_cmds = ( - 'inflate_bubble.set_fusato_server_installer_structure', - 'inflate_bubble.set_fusato_server_structure', - 'inflate_bubble.set_grub_shared', - 'inflate_bubble.set_binary_shared', - 'infra.shared_server_files', - 'infra.boostrap_shared' - ) +shared_setup_server_cmds = ('inflate_bubble.set_fusato_server_installer_structure', + 'inflate_bubble.set_fusato_server_structure', + 'infra.shared_server_files', + ) -shared_setup_mini_cmds = ( - 'inflate_bubble.set_fusato_mini_installer_structure', - 'inflate_bubble.set_binary_shared', - 'infra.mini_shared_installer_files' - ) +shared_setup_mini_cmds = ('inflate_bubble.set_fusato_mini_installer_structure', + 'inflate_bubble.set_binary_shared', + 'infra.mini_shared_installer_files' + ) flag_specific_setup_32_cmds = ( 'inflate_bubble.set_specific_32_packages',) @@ -97,13 +89,11 @@ setup_server_cmds = ('inflate_bubble.set_server', 'infra.server_configs', ) setup_mini_cmds = ('inflate_bubble.set_mini',) + # Setup grub chroot setup_chroot_grub_64 = ('inflate_bubble.set_chroot_grub_64',) setup_chroot_grub_arm = ('inflate_bubble.set_chroot_grub_arm',) setup_chroot_grub_32 = ('inflate_bubble.set_chroot_grub_32',) -setup_chroot_grub_64ld = ('inflate_bubble.set_chroot_grub_64ld',) -setup_chroot_grub_64srv = ('inflate_bubble.set_chroot_grub_64srv',) -setup_chroot_grub_64min = ('inflate_bubble.set_chroot_grub_64,min',) # Setup grub binary setup_binary_grub_64 = ('inflate_bubble.set_binary_64',) @@ -165,7 +155,7 @@ buildarm_opb_build = (shared_setup_cmds + setup_opb_cmds + setup_fw_arm ) -#Open_box +#Kde build64_kde_build = (shared_setup_cmds + setup_kde_cmds + setup_chroot_grub_64 + setup_binary_grub_64 + setup_fw_64_32 @@ -193,7 +183,6 @@ build32_loaded_build = (shared_setup_loaded_cmds + setup_loaded_cmds + #Server build64_server_build = (shared_setup_server_cmds + setup_server_cmds + - setup_chroot_grub_64 + setup_binary_grub_64 + setup_fw_64_32 ) @@ -276,89 +265,91 @@ OPENBOX_LIST = ('openbox\n' ) -LOADED_LIST = ('accountsservice\n' - 'apt-config-auto-update\n' - 'atril\n' - 'baobab\n' - 'bleachbit\n' - 'blueman\n' - 'catfish\n' - 'cheese\n' - 'ffmpegthumbnailer\n' - 'flatpak\n' - 'gnome-packagekit\n' - 'gnome-system-tools\n' - 'gvfs-backends\n' - 'gufw\n' - 'gnome-calculator\n' - 'gnome-2048\n' - 'gnome-chess\n' - 'gnome-mahjongg\n' - 'gnome-sudoku\n' - 'gimp\n' - 'gimp-data-extras\n' - 'gir1.2-flatpak-1.0\n' - 'inkscape\n' - 'menulibre\n' - 'libreoffice\n' - 'libreoffice-gtk3\n' - 'libreoffice-l10n*\n' - 'mintstick\n' - 'ntpsec-ntpdate\n' - 'ntpsec\n' - 'parole \n' - 'peplocale\n' - 'pepinstall\n' - 'printer-driver-cups-pdf\n' - 'qt5-style-plugins\n' - 'qt5ct\n' - 'squashfs-tools\n' - 'sticky\n' - 'transmission-gtk\n' - 'timeshift\n' - 'thunderbird\n' - 'thunderbird-l10n-all\n' - 'tumbler\n' - 'tumbler-plugins-extra\n' - 'system-config-printer\n' - 'tela-icon-theme\n' - 'xdg-user-dirs-gtk\n' - 'xfce4\n' +LOADED_LIST = ('xfce4\n' 'xfce4-goodies\n' - 'xfsdump\n' 'xorg\n' - 'xscreensaver\n' - 'xscreensaver-data\n' - 'xscreensaver-data-extra\n' - 'xscreensaver-gl\n' - 'xscreensaver-gl-extra\n' 'xserver-xorg\n' 'xserver-xorg-input-synaptics\n' 'xserver-xorg-input-all\n' 'xserver-xorg-video-vmware\n' 'xserver-xorg-video-all\n' + 'apt-config-auto-update\n' + 'gnome-system-tools\n' + 'gvfs-backends\n' + 'blueman\n' + 'bluez-cups\n' + 'bluez-alsa-utils\n' + 'gufw\n' + 'plank\n' + 'tela-icon-theme\n' + 'system-config-printer\n' + 'menulibre\n' + 'xscreensaver\n' + 'xscreensaver-data\n' + 'xscreensaver-data-extra\n' + 'xscreensaver-gl\n' + 'xscreensaver-gl-extra\n' + 'gnome-calculator\n' + 'accountsservice\n' + 'catfish\n' + 'timeshift\n' + 'pepinstall\n' + 'sticky\n' + 'mintstick\n' + 'peplocale\n' + 'bleachbit\n' + 'gimp\n' + 'gimp-data-extras\n' + 'inkscape\n' + 'atril\n' + 'transmission-gtk\n' + 'thunderbird\n' + 'thunderbird-l10n-all\n' + 'libreoffice\n' + 'libreoffice-gtk3\n' + 'libreoffice-l10n*\n' + 'printer-driver-cups-pdf\n' + 'gnome-2048\n' + 'gnome-chess\n' + 'gnome-mahjongg\n' + 'gnome-sudoku\n' + 'cheese\n' + 'parole \n' + 'qt5-style-plugins\n' + 'qt5ct\n' + 'xfsdump\n' + 'tumbler\n' + 'tumbler-plugins-extra\n' + 'ffmpegthumbnailer\n' + 'baobab\n' + 'xdg-user-dirs-gtk\n' + 'squashfs-tools\n' + 'flatpak\n' + 'gir1.2-flatpak-1.0\n' + 'ntpsec-ntpdate\n' + 'ntpsec\n' + 'mugshot\n' ) - -SERVER_LIST = ('btop\n' - 'cups\n' - 'debsecan\n' +SERVER_LIST = ('zonefstoolspep\n' 'dmzonedtoolspep\n' - 'firewalld\n' - 'gvfs-backends\n' - 'git\n' - 'net-tools\n' - 'nfs-common\n' 'libzbdpep1\n' 'sudo\n' - 'samba\n' - 'rkhunter\n' - 'sshguard\n' 'task-ssh-server\n' - 'task-web-server\n' + 'dialog\n' + 'sshguard\n' 'whois\n' + 'rkhunter\n' + 'debsecan\n' + 'net-tools\n' + 'nfs-common\n' + 'firewalld\n' + 'openssl\n' + 'cups\n' + 'git\n' + 'grub-pc\n' 'wget\n' - 'zonefstoolspep\n' + 'curl\n' ) @@ -446,14 +437,6 @@ GRUB_LIST_64 = ('grub-efi-amd64\n' 'grub-efi-ia32-bin\n' ) -# Grub things shared by 64bit -GRUB_LIST_64LD = ('grub-efi-amd64\n' - 'grub-efi-amd64-bin\n' - 'grub-efi-amd64-signed\n' - 'shim-helpers-amd64-signed\n' - 'grub-efi-ia32-bin\n' - ) - # Grub things shared by ARM GRUB_LIST_ARM64 = ('grub-efi-arm64\n' 'grub-efi-arm64-bin\n' @@ -507,8 +490,6 @@ FIRMWARE_LIST_32_64 = ('atmel-firmware\n' 'midisport-firmware\n' ) -# Frimware packages used by ARM -FIRMWARE_LIST_ARM = ('firmware-atheros\n' ### Inflate bubble section import paths src_paths = [paths.src_deb64_osrelease, @@ -813,12 +794,7 @@ BINARY_LIST_32 = ('grub-efi-ia32\n' 'grub-efi-ia32-signed\n' 'grub-efi-ia32-bin\n' 'shim-helpers-i386-signed\n' - 'firmware-libertas\n' - 'firmware-netxen\n' - 'firmware-zd1211\n' - 'firmware-ralink' - ) - + ) binary_list_64 = ('efibootmgr\n' 'grub-common\n' @@ -919,6 +895,7 @@ f' --distribution {debian_codename}' LBSET_DEVUAN_SHARED = ( f' --distribution {devuan_codename}' ' --initsystem sysvinit' +' --debootstrap-options --include=ca-certificates' ' --mirror-bootstrap http://deb.devuan.org/merged' ' --parent-mirror-bootstrap http://deb.devuan.org/merged' ' --parent-mirror-chroot http://deb.devuan.org/merged' diff --git a/python_modules/finish_cleanup.py b/python_modules/finish_cleanup.py index 0a4e3802..75de658c 100644 --- a/python_modules/finish_cleanup.py +++ b/python_modules/finish_cleanup.py @@ -10,7 +10,6 @@ import os import shutil from pathlib import Path from datetime import date -<<<<<<< HEAD import time # Set the home path used regardless the user logged in @@ -37,14 +36,12 @@ string_home = str(home_folder) def make_check_sum(): """ Generate the check sum files """ -<<<<<<< HEAD os.chdir(HOME_FOLDER + FUSATO_ROOT) current_working_directory = os.getcwd().replace('/', '/') for _, _, files in os.walk(current_working_directory): ======= current_dir = os.getcwd().replace('/', '/') for root, dirs, files in os.walk(current_dir): ->>>>>>> cc1e91f1 (Updated) for fiso in files: if fiso.endswith('.iso'): sha = "sha512sum " @@ -53,7 +50,6 @@ def make_check_sum(): os.system(gen_sum) -<<<<<<< HEAD def process_iso(base, arch, desktop): """ Process the ISO for a given base, architecture, and desktop. @@ -313,7 +309,6 @@ def kill_fusato(): def kill_old_iso(): """ Delete older ISOs""" -<<<<<<< HEAD base_path = BASE_DESTINATION arch_list = ['/deb32/', '/deb64/', '/debarm/', '/dev32/', '/dev64/', '/devarm/'] de_list = ['gfb', 'opb', 'xfce', 'loaded', 'server', 'mini', 'kde'] diff --git a/python_modules/fresh_bubble.py b/python_modules/fresh_bubble.py index f03829ac..e69356d9 100644 --- a/python_modules/fresh_bubble.py +++ b/python_modules/fresh_bubble.py @@ -23,7 +23,6 @@ def set_config_structure(): # you can add additional, folders to the array as needed, you can also # remove a folder if you do not deem it necessary to be used folders = ["aliases", "xfce", "wallpaper", "user_config", "theme", -<<<<<<< HEAD "sources", "icons", "profile", "polkit", "plymouth", "osrelease", "multimedia", "menu", "splash", "lightdm", "issue", "info", "hooks", "grub", "font", @@ -31,13 +30,6 @@ def set_config_structure(): "application", "PepProPixMaps", "PepProTools", "packages", "loaded-application", "loaded-hooks", "loaded-wallpaper", "loaded-xfce", "id_files", "server-hooks,", "server-installer", "server-firewall", "server-scripts" -======= - "sources", "icons", "gksudo", "profile", "polkit", - "plymouth", "osrelease", "multimedia", "menu", "splash", - "lightdm", "issue", "info", "hooks", "grub", "font", - "desktop_base", "database", "calamares_settings", - "application", "PepProPixMaps", "PepProTools", "packages" ->>>>>>> cc1e91f1 (Updated) ] for f in folders: if os.path.exists(f): @@ -47,8 +39,4 @@ def set_config_structure(): else: os.makedirs(f) -<<<<<<< HEAD set_config_structure() -======= -set_config_structure() ->>>>>>> cc1e91f1 (Updated) diff --git a/python_modules/inflate_bubble.py b/python_modules/inflate_bubble.py index 869dbded..158feaa9 100644 --- a/python_modules/inflate_bubble.py +++ b/python_modules/inflate_bubble.py @@ -9,7 +9,6 @@ import os from pathlib import Path -<<<<<<< HEAD import conf # Set the home path used regardless the user logged in @@ -68,8 +67,9 @@ def set_fusato_server_structure(): at the moment you deal with chroot, bootstrap, and includes-installer """ - make_chroot = ['etc/firewalld/zones', - 'boot/grub', + make_chroot = ['etc/firewalld/zones/', + 'boot/grub/', + 'usr/local/bin/', ] os.chdir(os.path.join(HOME_FOLDER, FUSATO_ROOT)) if os.path.exists('config'): @@ -498,4 +498,4 @@ def set_fusato_structure(): # make needed folders for f in make_fldrs: os.makedirs(working_path + f) ->>>>>>> cc1e91f1 (Updated) + diff --git a/python_modules/infra.py b/python_modules/infra.py index 978752f9..12f43657 100644 --- a/python_modules/infra.py +++ b/python_modules/infra.py @@ -309,6 +309,96 @@ def mini_shared_installer_files(): shutil.copy(src_path, des_path) logger.info(f"Copy completed: {des_path}") +class ServerConfigFiles: + """ + Copies server initial config files CHROOT depending on the base. + """ + ALLOWED_BASES = {"debsrv", "devsrv"} + 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 Server Files for base: {self.base}") + server_path = '/server/scripts/' + self.src_paths = ( + f'{server_path}{self.base}/welcome.sh', + f'{server_path}{self.base}/configure_apache2.sh', + f'{server_path}{self.base}/configure_firewalld.sh', + f'{server_path}{self.base}/configure_hostname.sh', + f'{server_path}{self.base}/configure_mariadb.sh', + f'{server_path}{self.base}/configure_nginx.sh', + f'{server_path}{self.base}/configure_php_and_docker.sh', + f'{server_path}{self.base}/configure_postfix.sh', + f'{server_path}{self.base}/configure_postgresql.sh', + f'{server_path}{self.base}/configure_sqlite.sh', + f'{server_path}{self.base}/configure_ssh.sh', + f'{server_path}{self.base}/configure_static_ip.sh', + f'{server_path}{self.base}/create_user.sh', + f'{server_path}{self.base}/update_and_install.sh' + ) + + self.des_paths = ( + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin', + '/usr/local/bin' + ) + self.copy_files() + + + def copy_files(self): + """ 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: + os.makedirs(full_des_path, exist_ok=True) + logger.info(f"Ensured directory exists: {full_des_path}") + except Exception as e: + logger.error(f"Error creating directory {full_des_path}: {e}") + 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('/') + ) + 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 + ) + else: + shutil.copy(full_src_path, full_des_path) + logger.info(MSG_FIN + full_des_path) + else: + 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""" + bases = ["debsrv", "devsrv", "invalid_base"] + for base in bases: + cls(base) class ArchitectureFiles: """