export declare const ROOTFS_INIT_SCRIPT = "#!/bin/sh\nset -eu\n\nCONSOLE=\"/dev/console\"\nif [ ! -c \"${CONSOLE}\" ]; then\n if [ -c /dev/ttyAMA0 ]; then\n CONSOLE=\"/dev/ttyAMA0\"\n elif [ -c /dev/ttyS0 ]; then\n CONSOLE=\"/dev/ttyS0\"\n else\n CONSOLE=\"\"\n fi\nfi\n\nlog() {\n if [ -n \"${CONSOLE}\" ]; then\n printf \"%s\\n\" \"$*\" > \"${CONSOLE}\" 2>/dev/null || printf \"%s\\n\" \"$*\"\n else\n printf \"%s\\n\" \"$*\"\n fi\n}\n\nlog_cmd() {\n if [ -n \"${CONSOLE}\" ]; then\n \"$@\" > \"${CONSOLE}\" 2>&1 || \"$@\" || true\n else\n \"$@\" || true\n fi\n}\n\nsetup_virtio_ports() {\n if [ ! -d /sys/class/virtio-ports ]; then\n return\n fi\n\n mkdir -p /dev/virtio-ports\n\n for port_path in /sys/class/virtio-ports/vport*; do\n if [ ! -e \"${port_path}\" ]; then\n continue\n fi\n\n port_device=\"$(basename \"${port_path}\")\"\n dev_node=\"/dev/${port_device}\"\n\n if [ ! -c \"${dev_node}\" ] && [ -r \"${port_path}/dev\" ]; then\n dev_nums=\"$(cat \"${port_path}/dev\" 2>/dev/null || true)\"\n major=\"${dev_nums%%:*}\"\n minor=\"${dev_nums##*:}\"\n if [ -n \"${major}\" ] && [ -n \"${minor}\" ]; then\n mknod \"${dev_node}\" c \"${major}\" \"${minor}\" 2>/dev/null || true\n chmod 600 \"${dev_node}\" 2>/dev/null || true\n fi\n fi\n\n if [ -r \"${port_path}/name\" ]; then\n port_name=\"$(cat \"${port_path}/name\" 2>/dev/null || true)\"\n port_name=\"$(printf \"%s\" \"${port_name}\" | tr -d '\\r\\n')\"\n if [ -n \"${port_name}\" ]; then\n ln -sf \"../${port_device}\" \"/dev/virtio-ports/${port_name}\" 2>/dev/null || true\n fi\n fi\n done\n}\n\nresolve_virtio_port_path() {\n expected=\"$1\"\n\n if [ -c \"/dev/virtio-ports/${expected}\" ]; then\n printf \"%s\n\" \"/dev/virtio-ports/${expected}\"\n return\n fi\n\n for port_path in /sys/class/virtio-ports/vport*; do\n if [ ! -e \"${port_path}\" ] || [ ! -r \"${port_path}/name\" ]; then\n continue\n fi\n\n port_name=\"$(cat \"${port_path}/name\" 2>/dev/null || true)\"\n port_name=\"$(printf \"%s\" \"${port_name}\" | tr -d '\\r\\n')\"\n if [ \"${port_name}\" = \"${expected}\" ]; then\n port_device=\"$(basename \"${port_path}\")\"\n printf \"%s\n\" \"/dev/${port_device}\"\n return\n fi\n done\n\n printf \"%s\n\" \"/dev/virtio-ports/${expected}\"\n}\n\nsetup_mitm_ca() {\n system_ca_bundle=\"\"\n for candidate in /etc/ssl/certs/ca-certificates.crt /etc/ssl/cert.pem /etc/pki/tls/certs/ca-bundle.crt; do\n if [ -r \"${candidate}\" ]; then\n system_ca_bundle=\"${candidate}\"\n break\n fi\n done\n\n mitm_ca_cert=\"/etc/gondolin/mitm/ca.crt\"\n if [ ! -r \"${mitm_ca_cert}\" ]; then\n if [ -n \"${system_ca_bundle}\" ]; then\n export SSL_CERT_FILE=\"${system_ca_bundle}\"\n fi\n return\n fi\n\n mitm_ca_install=\"/usr/local/share/ca-certificates/gondolin-mitm-ca.crt\"\n if mkdir -p /usr/local/share/ca-certificates 2>/dev/null; then\n if cp \"${mitm_ca_cert}\" \"${mitm_ca_install}\" 2>/dev/null; then\n if command -v update-ca-certificates > /dev/null 2>&1; then\n if update-ca-certificates > /dev/null 2>&1; then\n if [ -r /etc/ssl/certs/ca-certificates.crt ]; then\n system_ca_bundle=\"/etc/ssl/certs/ca-certificates.crt\"\n fi\n else\n log \"[init] update-ca-certificates failed\"\n fi\n fi\n fi\n fi\n\n runtime_ca_bundle=\"/run/gondolin/ca-certificates.crt\"\n mkdir -p /run/gondolin\n : > \"${runtime_ca_bundle}\"\n\n if [ -n \"${system_ca_bundle}\" ] && [ -r \"${system_ca_bundle}\" ]; then\n cat \"${system_ca_bundle}\" >> \"${runtime_ca_bundle}\" 2>/dev/null || true\n fi\n\n printf \"\\n\" >> \"${runtime_ca_bundle}\"\n cat \"${mitm_ca_cert}\" >> \"${runtime_ca_bundle}\" 2>/dev/null || true\n\n export SSL_CERT_FILE=\"${runtime_ca_bundle}\"\n export CURL_CA_BUNDLE=\"${runtime_ca_bundle}\"\n export REQUESTS_CA_BUNDLE=\"${runtime_ca_bundle}\"\n export NODE_EXTRA_CA_CERTS=\"${mitm_ca_cert}\"\n}\n\nmount -t proc proc /proc || log \"[init] mount proc failed\"\nmount -t sysfs sysfs /sys || log \"[init] mount sysfs failed\"\nmount -t devtmpfs devtmpfs /dev || log \"[init] mount devtmpfs failed\"\n\nmkdir -p /dev/pts /dev/shm /run\nmount -t devpts devpts /dev/pts || log \"[init] mount devpts failed\"\nmount -t tmpfs tmpfs /run || log \"[init] mount tmpfs failed\"\n\nexport PATH=/usr/sbin:/usr/bin:/sbin:/bin\n\nmkdir -p /tmp /var/tmp /var/cache /var/log /root /home\nmount -t tmpfs tmpfs /tmp || log \"[init] mount tmpfs /tmp failed\"\nmount -t tmpfs tmpfs /root || log \"[init] mount tmpfs /root failed\"\nchmod 700 /root || true\nmount -t tmpfs tmpfs /var/tmp || log \"[init] mount tmpfs /var/tmp failed\"\nmount -t tmpfs tmpfs /var/cache || log \"[init] mount tmpfs /var/cache failed\"\nmount -t tmpfs tmpfs /var/log || log \"[init] mount tmpfs /var/log failed\"\n\nmkdir -p /tmp/.cache /tmp/.config /tmp/.local/share\n\nexport HOME=/root\nexport TMPDIR=/tmp\nexport XDG_CACHE_HOME=/tmp/.cache\nexport XDG_CONFIG_HOME=/tmp/.config\nexport XDG_DATA_HOME=/tmp/.local/share\nexport UV_CACHE_DIR=/tmp/.cache/uv\nexport UV_SYSTEM_CERTS=true\n\nlog \"[init] /dev entries:\"\nlog_cmd ls -l /dev\nif [ -d /dev/virtio-ports ]; then\n log \"[init] /dev/virtio-ports:\"\n log_cmd ls -l /dev/virtio-ports\nelse\n log \"[init] /dev/virtio-ports missing\"\nfi\nif [ -d /sys/class/virtio-ports ]; then\n log \"[init] /sys/class/virtio-ports:\"\n log_cmd ls -l /sys/class/virtio-ports\nelse\n log \"[init] /sys/class/virtio-ports missing\"\nfi\n\nif modprobe virtio_console > /dev/null 2>&1; then\n log \"[init] loaded virtio_console\"\nfi\nsetup_virtio_ports\nif modprobe virtio_rng > /dev/null 2>&1; then\n log \"[init] loaded virtio_rng\"\nfi\nif [ -e /dev/hwrng ]; then\n log \"[init] starting rngd\"\n rngd -r /dev/hwrng -o /dev/random > /dev/null 2>&1 &\nelse\n log \"[init] /dev/hwrng missing\"\nfi\n\nif modprobe virtio_net > /dev/null 2>&1; then\n log \"[init] loaded virtio_net\"\nfi\n\nif command -v ip > /dev/null 2>&1; then\n ip link set lo up || true\n ip link set eth0 up || true\nelif command -v ifconfig > /dev/null 2>&1; then\n ifconfig lo up || true\n ifconfig eth0 up || true\nelse\n log \"[init] no network link tool (ip/ifconfig)\"\nfi\n\nif command -v udhcpc > /dev/null 2>&1; then\n UDHCPC_SCRIPT=\"/usr/share/udhcpc/default.script\"\n if [ ! -x \"${UDHCPC_SCRIPT}\" ]; then\n UDHCPC_SCRIPT=\"/sbin/udhcpc.script\"\n fi\n if [ -x \"${UDHCPC_SCRIPT}\" ]; then\n udhcpc -i eth0 -q -n -s \"${UDHCPC_SCRIPT}\" || log \"[init] udhcpc failed\"\n else\n udhcpc -i eth0 -q -n || log \"[init] udhcpc failed\"\n fi\nfi\n\nif modprobe fuse > /dev/null 2>&1; then\n log \"[init] loaded fuse\"\nfi\n\nsandboxfs_mount=\"/data\"\nsandboxfs_binds=\"\"\n\nif [ -r /proc/cmdline ]; then\n for arg in $(cat /proc/cmdline); do\n case \"${arg}\" in\n sandboxfs.mount=*)\n sandboxfs_mount=\"${arg#sandboxfs.mount=}\"\n ;;\n sandboxfs.bind=*)\n sandboxfs_binds=\"${arg#sandboxfs.bind=}\"\n ;;\n esac\n done\nfi\n\nwait_for_sandboxfs() {\n for i in $(seq 1 300); do\n if grep -q \" ${sandboxfs_mount} fuse.sandboxfs \" /proc/mounts; then\n return 0\n fi\n sleep 0.1\n done\n return 1\n}\n\nmkdir -p \"${sandboxfs_mount}\"\n\nsandboxfs_ready=0\nsandboxfs_error=\"sandboxfs mount not ready\"\n\nsetup_virtio_ports\n\nif [ -x /usr/bin/sandboxfs ]; then\n log \"[init] starting sandboxfs at ${sandboxfs_mount}\"\n SANDBOXFS_LOG=\"${CONSOLE:-/dev/null}\"\n if [ -z \"${SANDBOXFS_LOG}\" ]; then\n SANDBOXFS_LOG=\"/dev/null\"\n fi\n sandboxfs_rpc_path=\"$(resolve_virtio_port_path virtio-fs)\"\n log \"[init] sandboxfs rpc path ${sandboxfs_rpc_path}\"\n /usr/bin/sandboxfs --mount \"${sandboxfs_mount}\" --rpc-path \"${sandboxfs_rpc_path}\" > \"${SANDBOXFS_LOG}\" 2>&1 &\n\n if wait_for_sandboxfs; then\n sandboxfs_ready=1\n if [ -n \"${sandboxfs_binds}\" ]; then\n OLD_IFS=\"${IFS}\"\n IFS=\",\"\n for bind in ${sandboxfs_binds}; do\n if [ -z \"${bind}\" ]; then\n continue\n fi\n mkdir -p \"${bind}\"\n if [ \"${sandboxfs_mount}\" = \"/\" ]; then\n bind_source=\"${bind}\"\n else\n bind_source=\"${sandboxfs_mount}${bind}\"\n fi\n log \"[init] binding sandboxfs ${bind_source} -> ${bind}\"\n log_cmd mount --bind \"${bind_source}\" \"${bind}\"\n done\n IFS=\"${OLD_IFS}\"\n fi\n else\n log \"[init] sandboxfs mount not ready\"\n fi\nelse\n log \"[init] /usr/bin/sandboxfs missing\"\n sandboxfs_error=\"sandboxfs binary missing\"\nfi\n\nif [ \"${sandboxfs_ready}\" -eq 1 ]; then\n printf \"ok\\n\" > /run/sandboxfs.ready\nelse\n printf \"%s\\n\" \"${sandboxfs_error}\" > /run/sandboxfs.failed\nfi\n\nsetup_mitm_ca\n\nif [ -x /usr/bin/sandboxssh ]; then\n log \"[init] starting sandboxssh\"\n /usr/bin/sandboxssh > \"${CONSOLE:-/dev/null}\" 2>&1 &\nelse\n log \"[init] /usr/bin/sandboxssh missing\"\nfi\n\nif [ -x /usr/bin/sandboxingress ]; then\n log \"[init] starting sandboxingress\"\n /usr/bin/sandboxingress > \"${CONSOLE:-/dev/null}\" 2>&1 &\nelse\n log \"[init] /usr/bin/sandboxingress missing\"\nfi\n\nlog \"[init] starting sandboxd\"\n\nexec /usr/bin/sandboxd\n"; export declare const INITRAMFS_INIT_SCRIPT = "#!/bin/sh\nset -eu\n\nCONSOLE=\"/dev/console\"\nif [ ! -c \"${CONSOLE}\" ]; then\n if [ -c /dev/ttyAMA0 ]; then\n CONSOLE=\"/dev/ttyAMA0\"\n elif [ -c /dev/ttyS0 ]; then\n CONSOLE=\"/dev/ttyS0\"\n else\n CONSOLE=\"\"\n fi\nfi\n\nlog() {\n if [ -n \"${CONSOLE}\" ]; then\n printf \"%s\\n\" \"$*\" > \"${CONSOLE}\" 2>/dev/null || printf \"%s\\n\" \"$*\"\n else\n printf \"%s\\n\" \"$*\"\n fi\n}\n\nsetup_virtio_ports() {\n mkdir -p /dev/virtio-ports\n\n for port_path in /sys/class/virtio-ports/vport*; do\n if [ ! -e \"${port_path}\" ]; then\n continue\n fi\n\n port_device=\"$(basename \"${port_path}\")\"\n dev_node=\"/dev/${port_device}\"\n\n if [ ! -c \"${dev_node}\" ]; then\n dev_nums=\"$(cat \"${port_path}/dev\" 2>/dev/null || true)\"\n major=\"${dev_nums%%:*}\"\n minor=\"${dev_nums##*:}\"\n if [ -n \"${major}\" ] && [ -n \"${minor}\" ]; then\n mknod \"${dev_node}\" c \"${major}\" \"${minor}\" 2>/dev/null || true\n chmod 600 \"${dev_node}\" 2>/dev/null || true\n fi\n fi\n\n if [ -r \"${port_path}/name\" ]; then\n port_name=\"$(cat \"${port_path}/name\" 2>/dev/null || true)\"\n port_name=\"$(printf \"%s\" \"${port_name}\" | tr -d '\\r\\n')\"\n if [ -n \"${port_name}\" ]; then\n ln -sf \"../${port_device}\" \"/dev/virtio-ports/${port_name}\" 2>/dev/null || true\n fi\n fi\n done\n}\n\nwait_for_virtio_ports() {\n for i in $(seq 1 300); do\n setup_virtio_ports\n if [ -c /dev/virtio-ports/virtio-port ] && [ -c /dev/virtio-ports/virtio-fs ]; then\n return 0\n fi\n sleep 0.1\n done\n return 1\n}\n\nmount -t proc proc /proc || log \"[initramfs] mount proc failed\"\nmount -t sysfs sysfs /sys || log \"[initramfs] mount sysfs failed\"\nmount -t devtmpfs devtmpfs /dev || log \"[initramfs] mount devtmpfs failed\"\n\nmkdir -p /dev/pts /dev/shm /run\nmount -t devpts devpts /dev/pts || log \"[initramfs] mount devpts failed\"\nmount -t tmpfs tmpfs /run || log \"[initramfs] mount tmpfs failed\"\n\nexport PATH=/usr/sbin:/usr/bin:/sbin:/bin\n\nroot_device=\"/dev/vda\"\nroot_fstype=\"ext4\"\n\nif [ -r /proc/cmdline ]; then\n for arg in $(cat /proc/cmdline); do\n case \"${arg}\" in\n root=*)\n root_device=\"${arg#root=}\"\n ;;\n rootfstype=*)\n root_fstype=\"${arg#rootfstype=}\"\n ;;\n esac\n done\nfi\n\nmodprobe virtio_blk > /dev/null 2>&1 || true\nmodprobe ext4 > /dev/null 2>&1 || true\nmodprobe virtio_console > /dev/null 2>&1 || true\nmodprobe virtio_rng > /dev/null 2>&1 || true\nmodprobe virtio_net > /dev/null 2>&1 || true\nmodprobe fuse > /dev/null 2>&1 || true\n\nif ! wait_for_virtio_ports; then\n log \"[initramfs] virtio ports not ready\"\nfi\n\nif command -v ip > /dev/null 2>&1; then\n ip link set lo up || true\n ip link set eth0 up || true\nelif command -v ifconfig > /dev/null 2>&1; then\n ifconfig lo up || true\n ifconfig eth0 up || true\nfi\n\nif command -v udhcpc > /dev/null 2>&1; then\n UDHCPC_SCRIPT=\"/usr/share/udhcpc/default.script\"\n if [ ! -x \"${UDHCPC_SCRIPT}\" ]; then\n UDHCPC_SCRIPT=\"/sbin/udhcpc.script\"\n fi\n if [ -x \"${UDHCPC_SCRIPT}\" ]; then\n udhcpc -i eth0 -q -n -s \"${UDHCPC_SCRIPT}\" || log \"[initramfs] udhcpc failed\"\n else\n udhcpc -i eth0 -q -n || log \"[initramfs] udhcpc failed\"\n fi\nfi\n\nwait_for_block() {\n dev=\"$1\"\n for i in $(seq 1 50); do\n if [ -b \"${dev}\" ]; then\n return 0\n fi\n sleep 0.1\n done\n return 1\n}\n\nif ! wait_for_block \"${root_device}\"; then\n log \"[initramfs] root device ${root_device} not found\"\n exec sh\nfi\n\nmkdir -p /newroot\nif ! mount -t \"${root_fstype}\" \"${root_device}\" /newroot; then\n log \"[initramfs] failed to mount ${root_device}\"\n exec sh\nfi\n\nmkdir -p /newroot/proc /newroot/sys /newroot/dev /newroot/run\n\nif [ -s /etc/resolv.conf ]; then\n mkdir -p /newroot/etc\n cp /etc/resolv.conf /newroot/etc/resolv.conf 2>/dev/null || true\nfi\n\nexec switch_root /newroot /init\n"; //# sourceMappingURL=init-scripts.d.ts.map