mirror of
https://github.com/truenas/scale-build.git
synced 2025-12-20 02:49:28 +00:00
* Trixie related changes for scale-build
* Point to HM mirrors
* Update apt preferences for trixie
* Update debootstrap changes for trixie
* Minor fix
* Remove python3 package
* Remove mandatory explicit dep
* Use openjdk-21-jdk for kernel
* Update passwd
* There is no need for custom openssl now
* Move from libssl3 to libssl3t64
* Remove util-linux from build manifest
* Set env variable for spdk
* Don't buidl spdk for now
* ipmctl is not available in stable
* Remove legacy sysv unit stuff
* Comment out netdata for now
* Small umount fix
* Also umount efivars
* Update build manifest to reflect updated branches
* Remove nfs entry from mtree
* Make sure to umount efivars
* Properly have apt sources fixed in update image
* Pull in grub2-common
* Add netdata mirror
* Fix url
* Make sure corepack is non-interactive
* Update netdata groups
* Fix efivars mounting
* Properly use clean_mounts
* Add fixme for netdata
* Properly comment out spdk explicit deps
* Remove grub-efi-amd64-signed from iso
* Make sure efivarfs is definitely mounted
* Bring in isc-dhcp-client for now
* Revert "Bring in isc-dhcp-client for now"
This reverts commit 259ffebba5.
* Only try to umount efivarfs if host is actually efi based
* Update repo's branches
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
import logging
|
|
import os
|
|
import shutil
|
|
|
|
from scale_build.utils.run import run
|
|
from scale_build.utils.paths import CHROOT_BASEDIR, PKG_DIR, TMPFS
|
|
|
|
from .utils import PACKAGE_PATH
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def setup_chroot_basedir(bootstrapdir_obj):
|
|
if os.path.exists(CHROOT_BASEDIR):
|
|
shutil.rmtree(CHROOT_BASEDIR)
|
|
os.makedirs(TMPFS, exist_ok=True)
|
|
run(['mount', '-t', 'tmpfs', '-o', 'size=25G', 'tmpfs', TMPFS])
|
|
bootstrapdir_obj.restore_cache(CHROOT_BASEDIR)
|
|
run(['mount', 'proc', os.path.join(CHROOT_BASEDIR, 'proc'), '-t', 'proc'])
|
|
run(['mount', 'sysfs', os.path.join(CHROOT_BASEDIR, 'sys'), '-t', 'sysfs'])
|
|
os.makedirs(PACKAGE_PATH, exist_ok=True)
|
|
run(['mount', '--bind', PKG_DIR, PACKAGE_PATH])
|
|
|
|
|
|
def umount_tmpfs_and_clean_chroot_dir():
|
|
if os.path.exists(CHROOT_BASEDIR):
|
|
shutil.rmtree(CHROOT_BASEDIR)
|
|
run(['umount', '-f', TMPFS], check=False, log=False)
|
|
|
|
|
|
def umount_chroot_basedir():
|
|
for command in (
|
|
['umount', '-f', PACKAGE_PATH],
|
|
['umount', '-f', os.path.join(CHROOT_BASEDIR, 'proc')],
|
|
# Need to unmount efivarfs before sys (automatically mounted under sys)
|
|
['umount', '-f', os.path.join(CHROOT_BASEDIR, 'sys/firmware/efi/efivars')],
|
|
['umount', '-f', os.path.join(CHROOT_BASEDIR, 'sys')],
|
|
):
|
|
run(command, check=False, log=False)
|
|
|
|
|
|
def clean_mounts():
|
|
umount_chroot_basedir()
|
|
umount_tmpfs_and_clean_chroot_dir()
|