# Stage the prebuilt static nucleic-linux-agent binary (the guest vsock control-plane # agent, built per-arch from guest/nucleic-linux-agent/src/agent.c) plus its systemd unit # and a static enable symlink. The unit is the single source in guest/…/systemd — staged # here so the deb and the pre-narOS Ubuntu payload path can never drift. # # The enable symlink is shipped statically (not via `systemctl enable` in a postinst) so it # takes effect inside the mmdebstrap chroot, where no systemd is running (NAROS.md §4). stage() { local dest="$1" arch="$2" local bin="$OS_DIR/dist/bin/nucleic-linux-agent-$arch" local unit="$OS_DIR/../guest/nucleic-linux-agent/systemd/nucleic-linux-agent.service" if [ ! -x "$bin" ]; then echo "prebuilt binary missing: $bin" > "$dest/.skip-reason" return 1 fi install -D -m 0755 "$bin" "$dest/usr/local/bin/nucleic-linux-agent" install -D -m 0644 "$unit" "$dest/usr/lib/systemd/system/nucleic-linux-agent.service" install -d "$dest/etc/systemd/system/multi-user.target.wants" ln -sf /usr/lib/systemd/system/nucleic-linux-agent.service \ "$dest/etc/systemd/system/multi-user.target.wants/nucleic-linux-agent.service" }