42 lines
1.7 KiB
Python
42 lines
1.7 KiB
Python
version = "0.1"
|
|
revision = 1
|
|
description = "Base filesystem layout, accounts and system configuration"
|
|
license = "MIT"
|
|
url = "https://example.invalid/"
|
|
# Config-only package: no upstream source, just static files + an install phase.
|
|
# Install the full target set (`orchid install <dest>`) to get a bootable system;
|
|
# this package supplies the glue (accounts, fstab, /sbin/init, weston.ini).
|
|
host_deps = []
|
|
# bash provides the system shell; base-files points /usr/bin/sh at it.
|
|
deps = ["bash"]
|
|
|
|
|
|
def install(self):
|
|
d = self.dest_dir
|
|
self.run(
|
|
"sh",
|
|
"-c",
|
|
"set -e; "
|
|
f"install -d -m0755 '{d}/etc' '{d}/etc/profile.d' '{d}/etc/xdg/weston' "
|
|
f"'{d}/etc/udev/rules.d' '{d}/sbin' '{d}/usr/bin' '{d}/root' '{d}/home/user' "
|
|
f"'{d}/run' '{d}/var' '{d}/proc' '{d}/sys' '{d}/dev'; "
|
|
# POSIX shell for #!/bin/sh scripts (dinit services, etc.).
|
|
f"ln -sf bash '{d}/usr/bin/sh'; "
|
|
# Static config tree from files/.
|
|
f"cp -rp '{self.files}/etc/.' '{d}/etc/'; "
|
|
# dinit as PID 1 (boot with kernel cmdline init=/sbin/init).
|
|
f"ln -sf /usr/bin/dinit '{d}/sbin/init'; "
|
|
# Conventional compat symlinks: the ELF interpreter is /lib64/ld-linux,
|
|
# but glibc lives in /lib; programs/shells live in /usr/bin.
|
|
f"ln -sf lib '{d}/lib64'; "
|
|
f"ln -sf usr/bin '{d}/bin'; "
|
|
# /var/run -> /run (dinit binds its control socket at /var/run/dinitctl).
|
|
f"ln -sf /run '{d}/var/run'; "
|
|
# Ownership + sensitive perms.
|
|
f"chown -R 0:0 '{d}/etc' '{d}/root'; "
|
|
f"chmod 0600 '{d}/etc/shadow'; "
|
|
f"chmod 0700 '{d}/root'; "
|
|
f"chown -R 1000:1000 '{d}/home/user'; "
|
|
f"chmod 0755 '{d}/home/user'",
|
|
)
|