#!/bin/sh ROOTSRC=$1 shift OLDROOT=tmp/oldroot printf '%s\n' "fdmove 0 3" printf '%s\n' "if { mount --bind \"$ROOTSRC\" /mnt/chroot }" printf '%s\n' "cd /mnt/chroot" printf '%s\n' "if { mount -t proc proc proc }" printf '%s\n' "if { mount -t devpts devpts dev/pts }" printf '%s\n' "if { mount -t tmpfs tmp run }" printf '%s\n' "if { mount -t tmpfs tmp tmp }" printf '%s\n' "if { mkdir \"$OLDROOT\" tmp/bin }" printf '%s\n' "if { cp -a /bin/busybox /bin/chpst /bin/if tmp/bin }" printf '%s\n' "if { pivot_root . \"$OLDROOT\" }" awk -vROOT=/$OLDROOT '$5 {print "/tmp/bin/if { /tmp/bin/if -n -t { /tmp/bin/busybox umount "ROOT $5" } /tmp/bin/busybox umount -l "ROOT $5" }" }' /proc/self/mountinfo | tac printf '%s' "./tmp/bin/chpst -/ ." printf ' "%s"' "$@" printf '\n'