2023-07-11 06:48:53 +00:00
|
|
|
"""
|
|
|
|
* 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
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
from pathlib import Path
|
|
|
|
import conf
|
|
|
|
|
2023-09-05 14:38:55 +00:00
|
|
|
|
2023-07-11 06:48:53 +00:00
|
|
|
# Set the home path used regardless the user logged in
|
2023-08-24 06:16:56 +00:00
|
|
|
BSTRING_ISO_CONFIGS = '~/bubbles/iso_configs'
|
|
|
|
HOME_FOLDER = str(Path(BSTRING_ISO_CONFIGS).expanduser())
|
2023-12-11 10:16:13 -01:00
|
|
|
PACKAGE_LIST = "fusato/config/package-lists/"
|
|
|
|
CHROOT_FOLDER = "fusato/config/includes.chroot/"
|
|
|
|
BOOTSTRAP_FOLDER = 'fusato/config/includes.bootstrap/'
|
2023-12-11 10:11:05 -01:00
|
|
|
FUSATO_ROOT = 'fusato'
|
2023-07-11 06:48:53 +00:00
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
# Fusato base
|
|
|
|
def set_fusato_structure():
|
|
|
|
""" Make some needed folders for the fustao build process.
|
2023-12-11 10:11:05 -01:00
|
|
|
at the moment you deal with chroot and bootstrap
|
2023-08-24 06:16:56 +00:00
|
|
|
"""
|
2023-08-24 07:01:56 +00:00
|
|
|
make_chroot = ['usr/share/distro-info/',
|
|
|
|
'usr/share/python-apt/templates/',
|
2023-08-24 06:16:56 +00:00
|
|
|
'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',
|
2023-09-14 04:00:31 +00:00
|
|
|
'etc/skel/.config/autostart/',
|
2023-09-27 06:05:13 +00:00
|
|
|
'etc/lightdm/lightdm.conf.d/',
|
2023-08-24 06:16:56 +00:00
|
|
|
]
|
2023-12-11 10:01:18 -01:00
|
|
|
os.chdir(os.path.join(HOME_FOLDER, FUSATO_ROOT))
|
2023-08-24 07:01:56 +00:00
|
|
|
if os.path.exists('config'):
|
|
|
|
rm_cmd = "sudo rm -r -f config"
|
|
|
|
os.system(rm_cmd)
|
|
|
|
os.makedirs('config')
|
2023-12-11 10:01:18 -01:00
|
|
|
|
2023-08-24 07:01:56 +00:00
|
|
|
|
2023-08-27 10:41:53 +00:00
|
|
|
make_bootstrap = ['etc/apt']
|
|
|
|
make_packages = ['package-lists/']
|
2023-08-24 06:16:56 +00:00
|
|
|
make_chfldrs = make_chroot
|
2023-08-24 06:31:14 +00:00
|
|
|
for f_f in make_chfldrs:
|
2023-12-11 10:01:18 -01:00
|
|
|
os.makedirs(os.path.join(HOME_FOLDER, CHROOT_FOLDER, f_f))
|
2023-08-27 10:23:47 +00:00
|
|
|
for f_f in make_bootstrap:
|
2023-12-11 10:01:18 -01:00
|
|
|
os.makedirs(os.path.join(HOME_FOLDER, BOOTSTRAP_FOLDER, f_f))
|
2023-08-27 10:23:47 +00:00
|
|
|
for f_f in make_packages:
|
2023-12-11 10:01:18 -01:00
|
|
|
os.makedirs(os.path.join(HOME_FOLDER,PACKAGE_LIST, f_f))
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Commonly Shared
|
2023-12-11 10:01:18 -01:00
|
|
|
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)
|
|
|
|
|
2023-09-05 14:38:55 +00:00
|
|
|
|
|
|
|
def make_bld_xfce(base,arch):
|
2023-12-11 10:01:18 -01:00
|
|
|
"""Write the xfce build file"""
|
|
|
|
make_build_file(base, arch, 'xfc', 'XFCE Build')
|
2023-09-05 14:38:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def make_bld_gnomeflashback(base,arch):
|
2023-12-11 10:01:18 -01:00
|
|
|
"""Write the gnome fb build file"""
|
|
|
|
make_build_file(base, arch, 'gfb', 'Gnome Flash Back Build')
|
2023-09-05 14:38:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def make_bld_openbox(base,arch):
|
2023-12-11 10:01:18 -01:00
|
|
|
"""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):
|
|
|
|
"""Create the package list file with the specified content"""
|
2023-12-11 10:36:20 -01:00
|
|
|
with open(os.path.join(HOME_FOLDER, PACKAGE_LIST, file_name), 'a',
|
2023-12-11 10:01:18 -01:00
|
|
|
encoding='UTF-8') as f_p:
|
|
|
|
f_p.write(content)
|
|
|
|
|
2023-09-05 14:38:55 +00:00
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
def set_general_shared():
|
|
|
|
""" Create the list for general shared list"""
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('genshared.list.chroot', conf.GENERAL_SHARED_LIST, mode=x)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_grub_shared():
|
|
|
|
""" Create the list for shared grub list"""
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('grub.list.chroot', conf.GRUB_LIST_SHARED, mode=x)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_binary_shared():
|
|
|
|
""" Create the shared list for grub binary"""
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('installer.list.binary', conf.BINARY_LIST_SHARED, mode=x)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
2023-12-11 10:01:18 -01:00
|
|
|
# Light DM paklage list login window
|
2023-08-24 06:16:56 +00:00
|
|
|
def set_lightdm():
|
|
|
|
""" Create the list for the light dm list """
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('lightdm.list.chroot', conf.LIGHT_DM_LIST, mode=x)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Desktop Environments
|
|
|
|
def set_xfce():
|
|
|
|
""" Create the list for the xfce xfce list"""
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('xfce.list.chroot', conf.XFCE_LIST, mode=x)
|
2023-12-11 10:01:18 -01:00
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
|
2023-08-30 05:23:03 +00:00
|
|
|
def set_gfb():
|
|
|
|
""" Create the list for the xfce xfce list"""
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('gfb.list.chroot', conf.GNOME_FLASHBACK_LIST, mode=x)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
# CHROOT Specific
|
|
|
|
def set_chroot_grub_64():
|
|
|
|
""" Append the grub list for 64 bit grub"""
|
2023-12-11 10:01:18 -01:00
|
|
|
make_package_list('gfb.list.chroot', conf.GRUB_LIST_64)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_chroot_grub_arm():
|
|
|
|
""" Append the grub list for the ARM grub"""
|
2023-12-11 10:01:18 -01:00
|
|
|
make_package_list('gfb.list.chroot', conf.GRUB_LIST_ARM64)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_chroot_grub_32():
|
|
|
|
""" Append the grub list for the 32 bit grub"""
|
2023-12-11 10:01:18 -01:00
|
|
|
make_package_list('gfb.list.chroot', conf.GRUB_LIST_32)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Binary Specific
|
|
|
|
def set_binary_64():
|
|
|
|
""" Create the list for grub binary packages for 64 bit"""
|
2023-12-11 10:01:18 -01:00
|
|
|
make_package_list('installer.list.binary', conf.BINARY_LIST_64)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
def set_binary_arm():
|
|
|
|
""" Create the list for grub binary packages for 64 bit"""
|
2023-12-11 10:01:18 -01:00
|
|
|
make_package_list('installer.list.binary', conf.BINARY_LIST_ARM)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
def set_binary_32():
|
|
|
|
""" Create the list for grub binary packages for 32 bit"""
|
2023-12-11 10:01:18 -01:00
|
|
|
make_package_list('installer.list.binary', conf.BINARY_LIST_32)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
# Firmware Specific
|
|
|
|
def set_firmware():
|
2023-07-11 06:48:53 +00:00
|
|
|
""" Create the list for the firmware support for genral ISOs"""
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('firmware.list.chroot', conf.FIRMWARE_LIST_32_64, mode=x)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
def set_firmware_arm():
|
2023-07-11 06:48:53 +00:00
|
|
|
""" Create the list for the firmware support for arm ISOs"""
|
2023-12-11 10:36:20 -01:00
|
|
|
make_package_list('firmware.list.chroot', conf.FIRMWARE_LIST_ARM, mode=x)
|