#!/bin/sh
# PID 1 once / is the two layers (linux/init). Lives on the system disk.
# CONTRACT: saved disks keep their own copy of this system disk, so every later
# kernel and initramfs must still boot it: run /sbin/sosie-init as PID 1, with
# SOSIE_ROOT=saved or memory, and /proc, /sys and /dev already moved here.
export PATH=/bin:/sbin:/usr/bin:/usr/sbin HOME=/root
echo
echo "Welcome to Linux on sosie."
if [ "$SOSIE_ROOT" = saved ]; then
	echo "Changes to / are kept on your saved disk. Press Save now before closing the tab."
else
	echo "Changes are NOT being saved: they are lost when the machine stops."
fi
unset SOSIE_ROOT
[ ! -f /etc/sosie-agent ] || . /etc/sosie-agent
cd /root
# a controlling terminal, so job control and Ctrl-C work
setsid cttyhack sh
poweroff -f
