22 lines
609 B
Plaintext
22 lines
609 B
Plaintext
|
# NOTE: switch_root MAY move the mounts itself and the busybox implementation doesn't, so we move them ourselves
|
||
|
|
||
|
# Usual case
|
||
|
cat /proc/mounts | while read DEV DIR TYPE OPTS ; do
|
||
|
if [ "$DIR" != "/" -a "$DIR" != "/sysroot" -a -d "$DIR" ]; then
|
||
|
mkdir -p /sysroot/$DIR
|
||
|
mount -o move $DIR /sysroot/$DIR
|
||
|
fi
|
||
|
done
|
||
|
sync
|
||
|
exec switch_root /sysroot /sbin/init
|
||
|
|
||
|
# Template
|
||
|
cat /proc/mounts | while read DEV DIR TYPE OPTS ; do
|
||
|
if [ "$DIR" != "/" -a "$DIR" != "$sysroot" -a -d "$DIR" ]; then
|
||
|
mkdir -p $sysroot/$DIR
|
||
|
mount -o move $DIR $sysroot/$DIR
|
||
|
fi
|
||
|
done
|
||
|
sync
|
||
|
exec switch_root "$sysroot" "$init" "$init_args"
|