mirror of
https://github.com/getcompanion-ai/computer-guest.git
synced 2026-04-15 04:03:25 +00:00
feat: guestOS docker config (#3)
This commit is contained in:
commit
27f7b6318b
11 changed files with 660 additions and 0 deletions
40
microagent-init.sh
Normal file
40
microagent-init.sh
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
mountpoint -q /proc || mount -t proc proc /proc
|
||||
mountpoint -q /sys || mount -t sysfs sysfs /sys
|
||||
mountpoint -q /dev || mount -t devtmpfs devtmpfs /dev
|
||||
mountpoint -q /run || mount -t tmpfs tmpfs /run
|
||||
|
||||
mkdir -p /tmp /var/tmp /run/sshd /var/log
|
||||
chmod 1777 /tmp /var/tmp
|
||||
|
||||
# PID 1 is the guest supervisor: it brings up the minimum runtime surface and
|
||||
# stays alive to keep the VM services attached to a single lifecycle root.
|
||||
if ! /usr/local/bin/microagent-network-up >/var/log/network.log 2>&1; then
|
||||
cat /var/log/network.log >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then
|
||||
ssh-keygen -A
|
||||
fi
|
||||
|
||||
if [ -f /etc/microagent/authorized_keys ]; then
|
||||
install -d -m 0700 -o node -g node /home/node/.ssh
|
||||
install -m 0600 -o node -g node /etc/microagent/authorized_keys /home/node/.ssh/authorized_keys
|
||||
fi
|
||||
|
||||
if command -v jitterentropy-rngd >/dev/null 2>&1; then
|
||||
jitterentropy-rngd -v >/var/log/jitterentropy.log 2>&1 &
|
||||
fi
|
||||
|
||||
/usr/sbin/sshd -D -e >/var/log/sshd.log 2>&1 &
|
||||
/usr/local/bin/microagent-desktop-session >/var/log/desktop.log 2>&1 &
|
||||
|
||||
trap 'kill 0 || true; exit 0' INT TERM
|
||||
wait -n
|
||||
status=$?
|
||||
kill 0 || true
|
||||
wait || true
|
||||
exit "$status"
|
||||
Loading…
Add table
Add a link
Reference in a new issue