Skip to content

Commit

Permalink
set root password and hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
tomirgang committed Oct 19, 2024
1 parent 9163684 commit 0a0a272
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ebcl/tools/root/debootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,25 @@ def build_debootstrap_image(
check=True
)

# Set root password
if config.root_password:
fake.run_chroot(
f'echo "{config.root_password}" | passwd root --stdin',
chroot=config.target_dir,
check=True
)

# Set the hostname
if config.hostname:
hostname = config.hostname
if config.domain:
hostname = f'{hostname}.{config.domain}'
fake.run_chroot(
f'echo "{hostname}" | /etc/hostname',
chroot=config.target_dir,
check=True
)

# Update root
fake.run_chroot(
f'bash -c "{apt_env} apt update"',
Expand Down

0 comments on commit 0a0a272

Please sign in to comment.