Last active
August 29, 2015 14:14
-
-
Save cgwalters/f5869dddaa2236f13671 to your computer and use it in GitHub Desktop.
OSTree mount testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -xe | |
function umountcleanup() { | |
umount -R $1 2>/dev/null || true | |
} | |
umountcleanup initramfs | |
rm -f initramfs.img | |
dd if=/dev/zero of=initramfs.img seek=20M bs=1 count=1 | |
mkfs.xfs initramfs.img | |
rm -f rootfs.img | |
dd if=/dev/zero of=rootfs.img seek=100M bs=1 count=1 | |
mkfs.xfs rootfs.img | |
mkdir -p initramfs | |
mount -o loop initramfs.img ./initramfs | |
mkdir -p initramfs/sysroot | |
mount -o loop rootfs.img ./initramfs/sysroot | |
mount --make-rprivate ./initramfs/sysroot | |
cd initramfs | |
mkdir -p sysroot/deploy/ostree/sysroot | |
mkdir -p sysroot/deploy/ostree/var | |
mkdir -p sysroot/deploy/var | |
touch in-initramfs | |
touch sysroot/in-physroot | |
touch sysroot/deploy/var/in-var | |
touch sysroot/deploy/ostree/in-ostree | |
mount -c -n --bind ./sysroot/deploy/ostree ./sysroot/deploy/ostree | |
mount -c -n --bind ./sysroot ./sysroot/deploy/ostree/sysroot | |
mount -c -n --bind ./sysroot/deploy/var ./sysroot/deploy/ostree/var | |
mount -c -n --move ./sysroot/deploy/ostree ./sysroot | |
umount --lazy . | |
ls -al sysroot | |
echo "Running fake ostree shell..." | |
env PS1='<ostreetest> # ' bash | |
echo "Exiting fake ostree shell." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment