update pepbld.py
This commit is contained in:
parent
aee941c201
commit
9660509330
|
@ -1,97 +1,122 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
#
|
#
|
||||||
# SPDX-FileCopyrightText: 2023 PeppermintOS Team (peppermintosteam@proton.me)
|
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
|
os.environ["PATH"] = "/sbin:/usr/sbin:/usr/local/sbin:" + os.environ["PATH"]
|
||||||
|
|
||||||
# Set the working folder variable
|
# Set the working folder variable
|
||||||
uchinanchu = os.getcwd()
|
uchinanchu = os.getcwd()
|
||||||
|
|
||||||
|
# This cleanup might be better served in the BldHelper*.sh script.
|
||||||
# Create the build folder, move into it removing stale mountpoints and files there.
|
# Create the build folder, move into it removing stale mountpoints and files there.
|
||||||
if os.path.exists("fusato") and not os.path.isdir("fusato"):
|
if os.path.exists("fusato") and not os.path.isdir("fusato"):
|
||||||
os.remove("fusato")
|
os.remove("fusato")
|
||||||
elif not os.path.exists("fusato"):
|
elif not os.path.exists("fusato"):
|
||||||
os.makedirs("fusato")
|
os.mkdir("fusato")
|
||||||
|
|
||||||
os.chdir("fusato")
|
os.chdir("fusato")
|
||||||
subprocess.run("umount $(mount | grep '${PWD}/chroot' | tac | cut -f3 -d' ') 2>/dev/null", shell=True)
|
subprocess.run(["umount", "$(mount | grep '{}' | tac | cut -f3 -d' ')".format(os.path.join(os.getcwd(), "chroot"))], stderr=subprocess.DEVNULL)
|
||||||
for i in os.listdir() + ['.build']:
|
for item in os.listdir():
|
||||||
if i == 'cache':
|
if item == "cache":
|
||||||
continue
|
continue
|
||||||
else:
|
shutil.rmtree(item, ignore_errors=True)
|
||||||
os.system("rm -rf " + i)
|
|
||||||
|
|
||||||
# Defines Live Build settings
|
# Define as configurações do Live Build
|
||||||
lb_command = [
|
lb_command = [
|
||||||
"lb", "config", "noauto",
|
"lb", "config", "noauto",
|
||||||
"--binary-images", "iso-hybrid",
|
"--binary-images", "iso-hybrid",
|
||||||
"--architectures", "i386",
|
"--architectures", "amd64",
|
||||||
|
"--linux-flavours", "amd64",
|
||||||
"--distribution", "bookworm",
|
"--distribution", "bookworm",
|
||||||
"--archive-areas", "main contrib non-free non-free-firmware",
|
"--archive-areas", "main contrib non-free non-free-firmware",
|
||||||
"--firmware-chroot", "false",
|
"--apt-recommends", "true",
|
||||||
"--debian-installer", "netinst",
|
"--security", "true",
|
||||||
|
"--updates", "true",
|
||||||
|
"--backports", "true",
|
||||||
|
"--debian-installer", "live",
|
||||||
"--debian-installer-distribution", "bookworm",
|
"--debian-installer-distribution", "bookworm",
|
||||||
"--debian-installer-gui", "true",
|
"--debian-installer-gui", "true",
|
||||||
"--parent-mirror-debian-installer", "http://repo.peppermintos.com/packages",
|
"--parent-mirror-debian-installer", "http://repo.peppermintos.com/packages",
|
||||||
"--iso-preparer", "PeppermintOS-https://peppermintos.com/",
|
"--iso-preparer", "PeppermintOS-https://peppermintos.com/",
|
||||||
"--iso-publisher", "Peppermint OS Team",
|
"--iso-publisher", "Peppermint OS Team",
|
||||||
"--iso-volume", "PeppermintOS",
|
"--iso-volume", "PepOS-server",
|
||||||
"--image-name", "PepOS-mini-iso",
|
"--image-name", "PepOS-Server",
|
||||||
|
"--debian-installer-preseedfile", "preseed.cfg",
|
||||||
"--checksums", "sha512",
|
"--checksums", "sha512",
|
||||||
"--zsync", "false",
|
"--zsync", "false",
|
||||||
"--win32-loader", "false",
|
"--win32-loader", "false"
|
||||||
"--debian-installer-preseedfile", "preseed.cfg"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
subprocess.run(lb_command + sys.argv[1:])
|
subprocess.run(lb_command + sys.argv[1:], check=True)
|
||||||
|
|
||||||
# Setup the installer structure
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "lib", "finish-install.d"), exist_ok=True)
|
# Setup the chroot structure
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed"), exist_ok=True)
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer"), exist_ok=True)
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "repos"), exist_ok=True)
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "config", "package-lists"), exist_ok=True)
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "sources-final"), exist_ok=True)
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.chroot"), exist_ok=True)
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "keyrings"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "grub"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "apps"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "database"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "pixmaps"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "tools"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "protools"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "polkit"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "conf"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "py"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "lightdm"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "share"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "hooks", "normal"), exist_ok=True)
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "hooks", "normal"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "archives"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.binary"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.chroot", "boot", "grub"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.chroot", "etc", "default"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "share"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.chroot", "etc"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.chroot", "etc", "firewalld", "zones"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "grub"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "lib", "finish-install.d"), exist_ok=True)
|
||||||
|
|
||||||
shutil.copy(os.path.join(uchinanchu, "pepinstaller", "preseed", "preseed.cfg"), os.path.join(uchinanchu, "fusato", "config", "includes.installer"))
|
# Install software
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pephooks", "normal"), os.path.join(uchinanchu, "fusato", "config", "hooks", "normal"), dirs_exist_ok=True)
|
with open(os.path.join(uchinanchu, "fusato", "config", "package-lists", "package.list.chroot"), "a") as file:
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepscripts"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "lib", "finish-install.d"), dirs_exist_ok=True)
|
file.write("# Install system packages.\n")
|
||||||
shutil.copy(os.path.join(uchinanchu, "pepsources", "multimedia.list"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "repos"))
|
file.write("zonefstoolspep\n")
|
||||||
shutil.copy(os.path.join(uchinanchu, "pepsources", "peppermint.list"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "repos"))
|
file.write("dmzonedtoolspep\n")
|
||||||
shutil.copy(os.path.join(uchinanchu, "pepsources", "sources.list"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "sources-final"))
|
file.write("libzbdpep1\n")
|
||||||
shutil.copy(os.path.join(uchinanchu, "pepsources", "sources.list"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "repos"))
|
file.write("sudo\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepkeyrings"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "keyrings"), dirs_exist_ok=True)
|
file.write("task-ssh-server\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "polkit"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "polkit"), dirs_exist_ok=True)
|
file.write("task-web-server\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepapplication"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "apps"), dirs_exist_ok=True)
|
file.write("sshguard\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepdatabase"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "database"), dirs_exist_ok=True)
|
file.write("htop\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "PepProPixMaps"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "pixmaps"), dirs_exist_ok=True)
|
file.write("whois\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepconf"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "conf"), dirs_exist_ok=True)
|
file.write("rkhunter\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "PepProTools"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "protools"), dirs_exist_ok=True)
|
file.write("debsecan\n")
|
||||||
shutil.copytree(os.path.join(uchinanchu, "peplightdm"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "lightdm"), dirs_exist_ok=True)
|
file.write("net-tools\n")
|
||||||
|
file.write("cockpit\n")
|
||||||
|
file.write("cockpit-podman\n")
|
||||||
|
file.write("cockpit-machines\n")
|
||||||
|
file.write("cockpit-pcp\n")
|
||||||
|
file.write("podman\n")
|
||||||
|
file.write("nfs-common\n")
|
||||||
|
file.write("firewalld\n")
|
||||||
|
file.write("samba\n")
|
||||||
|
file.write("cups\n")
|
||||||
|
file.write("gvfs-backends\n")
|
||||||
|
file.write("git\n")
|
||||||
|
file.write("wget\n")
|
||||||
|
|
||||||
# Copy recursive files and sub-directories
|
# Copy single files and folder to the chroot
|
||||||
shutil.copytree(os.path.join(uchinanchu, "peploadersplash", "debian"), os.path.join(uchinanchu, "fusato", "config", "includes.binary"), dirs_exist_ok=True)
|
shutil.copy2(os.path.join(uchinanchu, "pepgrub", "grub"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "grub"))
|
||||||
shutil.copytree(os.path.join(uchinanchu, "peploadersplash", "debian"), os.path.join(uchinanchu, "fusato", "config", "includes.binary"), dirs_exist_ok=True)
|
for item in os.listdir(os.path.join(uchinanchu, "pephooks", "normal")):
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepinstaller", "graphics"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "share"), dirs_exist_ok=True)
|
shutil.copy2(os.path.join(uchinanchu, "pephooks", "normal", item), os.path.join(uchinanchu, "fusato", "config", "hooks", "normal"))
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepinstaller", "themes"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "share"), dirs_exist_ok=True)
|
for item in os.listdir(os.path.join(uchinanchu, "peprepo")):
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pepgrub", "debian"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "grub"), dirs_exist_ok=True)
|
shutil.copy2(os.path.join(uchinanchu, "peprepo", item), os.path.join(uchinanchu, "fusato", "config", "archives"))
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pylibraries"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "py"), dirs_exist_ok=True)
|
for item in os.listdir(os.path.join(uchinanchu, "pepfirewall")):
|
||||||
shutil.copytree(os.path.join(uchinanchu, "pmostools"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "preseed", "tools"), dirs_exist_ok=True)
|
shutil.copy2(os.path.join(uchinanchu, "pepfirewall", item), os.path.join(uchinanchu, "fusato", "config", "includes.chroot", "etc", "firewalld", "zones"))
|
||||||
|
shutil.copy2(os.path.join(uchinanchu, "pepinstaller", "preseed", "preseed.cfg"), os.path.join(uchinanchu, "fusato", "config", "includes.installer"))
|
||||||
|
for item in os.listdir(os.path.join(uchinanchu, "pepscripts")):
|
||||||
|
shutil.copy2(os.path.join(uchinanchu, "pepscripts", item), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "lib", "finish-install.d"))
|
||||||
|
|
||||||
subprocess.run("lb build", shell=True)
|
# Copy recursive files and sub-directories, containing symlinks.
|
||||||
|
shutil.copytree(os.path.join(uchinanchu, "peploadersplash", "boot"), os.path.join(uchinanchu, "fusato", "config", "includes.binary", "boot"))
|
||||||
|
shutil.copytree(os.path.join(uchinanchu, "peploadersplash", "isolinux"), os.path.join(uchinanchu, "fusato", "config", "includes.binary", "isolinux"))
|
||||||
|
shutil.copytree(os.path.join(uchinanchu, "pepgrub", "themes"), os.path.join(uchinanchu, "fusato", "config", "includes.chroot", "boot", "grub", "themes"))
|
||||||
|
shutil.copytree(os.path.join(uchinanchu, "pepinstaller", "graphics"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "share", "graphics"))
|
||||||
|
shutil.copytree(os.path.join(uchinanchu, "pepinstaller", "themes"), os.path.join(uchinanchu, "fusato", "config", "includes.installer", "usr", "share", "themes"))
|
||||||
|
|
||||||
|
subprocess.run(["lb", "build"], check=True)
|
||||||
|
|
Loading…
Reference in New Issue