#!/bin/sh

ROOT="/mnt/.root"
ROOT_DEV="/dev/sda1"

echo "OpenCN initrd filesystem - now executing init from initramfs"

# mount temporary filesystems
mount -n -t proc     proc     /proc
mount -n -t sysfs    sysfs    /sys
mount -n -t tmpfs    tmpfs    /run
sleep 2
# mount new root
[ -d ${ROOT} ] || mkdir -p ${ROOT}
mount ${ROOT_DEV} ${ROOT}

# switch to new rootfs and exec init
cd ${ROOT}
exec switch_root . "/init" "$@"
