builder: build: filesystem.py: allow add custom kernel and firmware

Signed-off-by: BigfootACA <bigfoot@classfun.cn>
This commit is contained in:
BigfootACA 2024-07-21 17:31:36 +08:00
parent 8ed06d8f8b
commit 0d8ef8a67c

View File

@ -78,8 +78,17 @@ def check_allowed(path: str, action: str):
1. /etc/ is used for administrator configs 1. /etc/ is used for administrator configs
2. /boot/ is used for system boot up, you can put bootloaders configs into this folder 2. /boot/ is used for system boot up, you can put bootloaders configs into this folder
3. /var/ is used for daemons runtime states 3. /var/ is used for daemons runtime states
3. /usr/lib/modules/ is used for kernel modules (custom kernel)
3. /usr/lib/firmware/ is used for system firmware (custom firmware)
""" """
if not path.startswith(("/etc/", "/boot/", "/var/")): allow_list = (
"/etc/",
"/boot/",
"/var/",
"/usr/lib/modules",
"/usr/lib/firmware",
)
if not path.startswith(allow_list):
raise ArchBuilderConfigError(f"{action} {path} is not allowed") raise ArchBuilderConfigError(f"{action} {path} is not allowed")