diff --git a/python_modules/inflate_bubble.py b/python_modules/inflate_bubble.py index 046553b7..e66293e8 100644 --- a/python_modules/inflate_bubble.py +++ b/python_modules/inflate_bubble.py @@ -1,68 +1,175 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -# -# SPDX-FileCopyrightText: 2023 PeppermintOS Team (peppermintosteam@proton.me) +""" +* Author: "PeppermintOS Team(peppermintosteam@proton.me) +* +* License: SPDX-License-Identifier: GPL-3.0-or-later +* +* These functions will build the base of the fusato build folders +* As well as commonly used functions +""" -# This Make file is used to execute the different parts if the bubble system -# by running for example deb64 will chain execute copy_fls, copy_flders and -# inflate to build an ISO . To begin a fresh skeleton, you need to run only -# fresh...after that. As build sare release for publication you can run nightly -# or release to move the files to your web server location the -# run the build you need. -# None of these steps need to run as root all this can be ran ad a normal user +import os +from pathlib import Path +import conf -PY_PATH = ~/bubbles/python_modules -## 64 bit ISOs +# Set the home path used regardless the user logged in +BSTRING_ISO_CONFIGS = '~/bubbles/iso_configs' +HOME_FOLDER = str(Path(BSTRING_ISO_CONFIGS).expanduser()) +PACKAGE_LIST = "fusato/config/package-lists/" +CHROOT_FOLDER = "fusato/config/includes.chroot/" +BOOTSTRAP_FOLDER = 'fusato/config/includes.bootstrap/' +FUSATO_ROOT = 'fusato' -dev64xfce: - python3 ${PY_PATH}/build_iso.py set e-xfce b-dev64 -deb64xfce: - python3 ${PY_PATH}/build_iso.py set e-xfce b-deb64 -deb64gfb: - python3 ${PY_PATH}/build_iso.py set e-gnomefb b-deb64 -dev64gfb: - python3 ${PY_PATH}/build_iso.py set e-gnomefb b-dev64 -deb64opb: - python3 ${PY_PATH}/build_iso.py set e-openbox b-deb64 -dev64opb: - python3 ${PY_PATH}/build_iso.py set e-openbox b-dev64 -deb64loadxf: - python3 ${PY_PATH}/build_iso.py set e-loadxf b-deb64 -dev64loadxf: - python3 ${PY_PATH}/build_iso.py set e-loadxf b-dev64 +# Fusato base +def set_fusato_structure(): + """ Make some needed folders for the fustao build process. + at the moment you deal with chroot and bootstrap + """ + make_chroot = ['usr/share/distro-info/', + 'usr/share/python-apt/templates/', + 'usr/share/icons/default', + 'usr/share/peppermint/', + 'usr/share/themes/', + 'usr/local/bin/', + 'usr/bin/', + 'usr/sbin', + 'etc/lightdm', + 'etc/default', + 'etc/apt', + 'etc/apt/preferences.d', + 'etc/apt/sources.list.d', + 'etc/skel/Desktop', + 'etc/skel/.local/share', + 'etc/skel/.config/autostart/', + 'etc/lightdm/lightdm.conf.d/', + ] + os.chdir(os.path.join(HOME_FOLDER, FUSATO_ROOT)) + if os.path.exists('config'): + rm_cmd = "sudo rm -r -f config" + os.system(rm_cmd) + os.makedirs('config') -## 32 bit ISOs -deb32xfce: - python3 ${PY_PATH}/build_iso.py set e-xfce b-deb32 -dev32xfce: - python3 ${PY_PATH}/build_iso.py set e-xfce b-dev32 -deb32gfb: - python3 ${PY_PATH}/build_iso.py set e-gnomefb b-deb32 -dev32gfb: - python3 ${PY_PATH}/build_iso.py set e-gnomefb b-dev32 -deb32opb: - python3 ${PY_PATH}/build_iso.py set e-openbox b-deb32 -dev32opb: - python3 ${PY_PATH}/build_iso.py set e-openbox b-dev32 -## arm ISOs -debarmxfce: - python3 ${PY_PATH}/build_iso.py set e-xfce b-debarm -devarmxfce: - python3 ${PY_PATH}/build_iso.py set e-xfce b-devarm -debarmgfb: - python3 ${PY_PATH}/build_iso.py set e-gnomefb b-debarm -devarmgfb: - python3 ${PY_PATH}/build_iso.py set e-gnomefb b-devarm -debarmopb: - python3 ${PY_PATH}/build_iso.py set e-openbox b-debarm -devarmopb: - python3 ${PY_PATH}/build_iso.py set e-openbox b-devarm - -release: - python3 ${PY_PATH}/release.py + make_bootstrap = ['etc/apt'] + make_packages = ['package-lists/'] + make_chfldrs = make_chroot + for f_f in make_chfldrs: + os.makedirs(os.path.join(HOME_FOLDER, CHROOT_FOLDER, f_f)) + for f_f in make_bootstrap: + os.makedirs(os.path.join(HOME_FOLDER, BOOTSTRAP_FOLDER, f_f)) + for f_f in make_packages: + os.makedirs(os.path.join(HOME_FOLDER,PACKAGE_LIST, f_f)) -# run this to start with a blank shell for -# config folders/ -fresh: - python3 ${PY_PATH}/fresh_bubble.py + +# Commonly Shared +def make_build_file(base, arch, extension, build_description): + """ + 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}' + ) + 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') + +# Make the shared package lists files +def make_package_list(file_name, content, mode='a'): + """Create the package list file with the specified content""" + with open(os.path.join(HOME_FOLDER, PACKAGE_LIST, file_name), mode, + encoding='UTF-8') as f_p: + f_p.write(content) + + +def set_general_shared(): + """ Create the list for general shared list""" + make_package_list('genshared.list.chroot', conf.GENERAL_SHARED_LIST, 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') + + +def set_binary_shared(): + """ Create the shared list for grub binary""" + make_package_list('installer.list.binary', conf.BINARY_LIST_SHARED, mode='x') + + +# Light DM paklage 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') + + +# Desktop Environments +def set_xfce(): + """ Create the list for the xfce xfce list""" + 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') + +def set_opb(): + """ Create the list for the openbox list""" + make_package_list('opb.list.chroot', conf.OPENBOX_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 genral ISOs""" + 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')