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-08-27 08:56:34 +00:00
|
|
|
PACKAGE_LIST = "/fusato/config/package-lists/"
|
2023-08-24 12:48:16 +00:00
|
|
|
CHROOT_FOLDER = "/fusato/config/includes.chroot/"
|
|
|
|
BOOTSTRAP_FOLDER = '/fusato/config/includes.bootstrap/'
|
2023-09-05 14:38:55 +00: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.
|
|
|
|
at the moment you deal wioth chroot and bootstrap
|
|
|
|
"""
|
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-08-24 12:48:16 +00:00
|
|
|
os.chdir(HOME_FOLDER + '/fusato')
|
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')
|
|
|
|
else:
|
|
|
|
pass
|
|
|
|
|
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:
|
|
|
|
os.makedirs(HOME_FOLDER + CHROOT_FOLDER + f_f)
|
2023-08-27 10:23:47 +00:00
|
|
|
for f_f in make_bootstrap:
|
2023-08-24 06:31:14 +00:00
|
|
|
os.makedirs(HOME_FOLDER + BOOTSTRAP_FOLDER + f_f)
|
2023-08-27 10:23:47 +00:00
|
|
|
for f_f in make_packages:
|
|
|
|
os.makedirs(HOME_FOLDER + PACKAGE_LIST + f_f)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Commonly Shared
|
2023-09-05 14:38:55 +00:00
|
|
|
|
|
|
|
def make_bld_xfce(base,arch):
|
|
|
|
"""Write the build file"""
|
|
|
|
with open(HOME_FOLDER + FUSATO_ROOT + '/' + base + '.' + arch + 'xfc',
|
|
|
|
'w', encoding='UTF-8') as f_p:
|
|
|
|
f_p.write('XFCE Build')
|
|
|
|
|
|
|
|
|
|
|
|
def make_bld_gnomeflashback(base,arch):
|
|
|
|
"""Write the build file"""
|
|
|
|
with open(HOME_FOLDER + FUSATO_ROOT + '/' + base + '.' + arch + 'gfb',
|
|
|
|
'w', encoding='UTF-8') as f_p:
|
|
|
|
f_p.write('Gnome Flash Back Build')
|
|
|
|
|
|
|
|
|
|
|
|
def make_bld_openbox(base,arch):
|
|
|
|
"""Write the build file"""
|
|
|
|
with open(HOME_FOLDER + FUSATO_ROOT+ '/' + base + '.' + arch + 'opb',
|
|
|
|
'w', encoding='UTF-8') as f_p:
|
|
|
|
f_p.write('OpenBox Build')
|
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
def set_general_shared():
|
|
|
|
""" Create the list for general shared list"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'genshared.list.chroot', 'x',
|
2023-08-24 06:31:14 +00:00
|
|
|
encoding='UTF-8') as general_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
general_file.write(conf.GENERAL_SHARED_LIST)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_grub_shared():
|
|
|
|
""" Create the list for shared grub list"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'x',
|
|
|
|
encoding='UTF-8') as system_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
system_file.write(conf.GRUB_LIST_SHARED)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_binary_shared():
|
|
|
|
""" Create the shared list for grub binary"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'x',
|
|
|
|
encoding='UTF-8') as binary_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
binary_file.write(conf.BINARY_LIST_SHARED)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_lightdm():
|
|
|
|
""" Create the list for the light dm list """
|
2023-08-24 06:31:14 +00:00
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'lightdm.list.chroot', 'x',
|
|
|
|
encoding='UTF-8') as lightdm_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
lightdm_file.write(conf.LIGHT_DM_LIST)
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Desktop Environments
|
|
|
|
def set_xfce():
|
|
|
|
""" Create the list for the xfce xfce list"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'xfce.list.chroot', 'x',
|
|
|
|
encoding='UTF-8') as xfce_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
xfce_file.write(conf.XFCE_LIST)
|
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"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'gfb.list.chroot', 'x',
|
|
|
|
encoding='UTF-8') as gfb_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
gfb_file.write(conf.GNOME_FLASHBACK_LIST)
|
2023-08-30 05:23:03 +00:00
|
|
|
|
2023-08-24 06:16:56 +00:00
|
|
|
|
|
|
|
# CHROOT Specific
|
|
|
|
def set_chroot_grub_64():
|
|
|
|
""" Append the grub list for 64 bit grub"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'a',
|
|
|
|
encoding='UTF-8') as system_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
system_file.write(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"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'a',
|
|
|
|
encoding='UTF-8') as system_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
system_file.write(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"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'grub.list.chroot', 'a',
|
|
|
|
encoding='UTF-8') as system_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
system_file.write(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"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'a',
|
|
|
|
encoding='UTF-8') as binary_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
binary_file.write(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"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'a',
|
|
|
|
encoding='UTF-8') as binary_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
binary_file.write(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"""
|
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'installer.list.binary', 'a',
|
|
|
|
encoding='UTF-8') as binary_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
binary_file.write(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-08-24 06:31:14 +00:00
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'firmware.list.chroot', 'x',
|
2023-08-24 06:16:56 +00:00
|
|
|
encoding='UTF-8') as firmware_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
firmware_file.write(conf.FIRMWARE_LIST_32_64)
|
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-08-24 06:31:14 +00:00
|
|
|
with open(HOME_FOLDER + PACKAGE_LIST + 'firmware.list.chroot', 'x',
|
2023-08-24 06:16:56 +00:00
|
|
|
encoding='UTF-8') as firmware_file:
|
2023-09-05 14:38:55 +00:00
|
|
|
firmware_file.write(conf.FIRMWARE_LIST_ARM)
|