mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-22 21:25:43 -05:00
image.py: use new constants.POST_CMDS for post-cmd instead of per-flavour cmd
This commit is contained in:
parent
b3e2059196
commit
3c91abd175
2 changed files with 8 additions and 5 deletions
|
@ -66,6 +66,9 @@ FLAVOURS: dict[str, Flavour] = {
|
|||
}
|
||||
}
|
||||
|
||||
POST_CMDS = ['kupfer-config apply']
|
||||
|
||||
|
||||
REPOSITORIES = [
|
||||
'boot',
|
||||
'cross',
|
||||
|
|
10
image.py
10
image.py
|
@ -10,7 +10,7 @@ from subprocess import CompletedProcess
|
|||
from typing import Union
|
||||
|
||||
from chroot.device import DeviceChroot, get_device_chroot
|
||||
from constants import Arch, BASE_PACKAGES, FLAVOURS
|
||||
from constants import Arch, BASE_PACKAGES, FLAVOURS, POST_CMDS
|
||||
from config import config, Profile
|
||||
from distro.distro import get_base_distro, get_kupfer_https
|
||||
from exec.cmd import run_root_cmd, generate_cmd_su
|
||||
|
@ -306,7 +306,6 @@ def install_rootfs(
|
|||
profile: Profile,
|
||||
):
|
||||
user = profile['username'] or 'kupfer'
|
||||
post_cmds = FLAVOURS[flavour.name].get('post_cmds', [])
|
||||
chroot = get_device_chroot(device=get_device_name(device), flavour=flavour.name, arch=arch, packages=packages, use_local_repos=use_local_repos)
|
||||
|
||||
mount_chroot(rootfs_device, bootfs_device, chroot)
|
||||
|
@ -329,12 +328,13 @@ def install_rootfs(
|
|||
extra_repos=get_kupfer_https(arch).repos,
|
||||
in_chroot=True,
|
||||
),
|
||||
'etc/hostname': profile['hostname'],
|
||||
'etc/hostname': profile['hostname'] or 'kupfer',
|
||||
}
|
||||
for target, content in files.items():
|
||||
root_write_file(os.path.join(chroot.path, target.lstrip('/')), content)
|
||||
if post_cmds:
|
||||
result = chroot.run_cmd(' && '.join(post_cmds))
|
||||
if POST_CMDS:
|
||||
logging.info("Running post-install CMDs")
|
||||
result = chroot.run_cmd(' && '.join(POST_CMDS))
|
||||
assert isinstance(result, subprocess.CompletedProcess)
|
||||
if result.returncode != 0:
|
||||
raise Exception('Error running post_cmds')
|
||||
|
|
Loading…
Add table
Reference in a new issue