Created
January 5, 2016 17:40
-
-
Save alban/75f605b8606b195008d6 to your computer and use it in GitHub Desktop.
udevd-experiment.sh
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/bash | |
set -e | |
# Try with: | |
# sudo $PWD/udevd-experiment.sh | |
THIS_SCRIPT=$0 | |
if [ "$1" = "udevd1" ] ; then | |
unshare --propagation unchanged -m $THIS_SCRIPT udevd2 | |
exit 0 | |
fi | |
if [ "$1" = "udevd2" ] ; then | |
mount --make-rslave / | |
mount --make-rshared / | |
sleep 5000 | |
exit 0 | |
fi | |
$THIS_SCRIPT udevd1 & | |
sleep 1 | |
DIR=/tmp/udevd-experiment-$RANDOM | |
mkdir $DIR | |
cd $DIR | |
mkdir rootfs | |
mount --bind / $DIR/rootfs | |
mount --make-rslave $DIR/rootfs | |
mount --make-rshared $DIR/rootfs | |
echo In the host namespace: | |
cat /proc/self/mountinfo|grep /tmp | |
echo In the udevd namespace: | |
cat /proc/$(pidof sleep)/mountinfo|grep /tmp | |
umount $DIR/rootfs | |
echo In the host namespace: | |
cat /proc/self/mountinfo|grep /tmp | |
echo In the udevd namespace: | |
cat /proc/$(pidof sleep)/mountinfo|grep /tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment