Skip to content

Commit

Permalink
fix device mapping issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AlkenePan committed Oct 26, 2022
1 parent 083c723 commit 5524a29
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rasp/mount_script
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ while read A B C SUBROOT MOUNT JUNK

[ $MOUNT = $FILESYS ] # More sanity check!
SUBPATH=$(echo $REALPATH | sed s,^$FILESYS,,)
DEVDEC=$(printf "%d %d" $(stat --format "0x%t 0x%T" $DEV))
REALDEV=$(readlink --canonicalize $DEV)
DEVDEC=$(printf "%d %d" $(stat --format "0x%t 0x%T" $REALDEV))
run_command="$NSENTER_PATH --target $PID --mount --uts --ipc --net --pid -- /bin/sh -c"
if [ `$run_command "export PATH=/usr/bin:/bin:/sbin;mount|grep $CONTPATH|wc -l"` -ne 0 ];then
echo "container mount dir $CONTPATH is mounting!"
exit 0
fi
$run_command "export PATH=/usr/bin:/bin:/sbin;[ -b $DEV ] ||mknod --mode 0600 $DEV b $DEVDEC"
$run_command "export PATH=/usr/bin:/bin:/sbin;mkdir -p $(dirname $REALDEV)"
$run_command "export PATH=/usr/bin:/bin:/sbin;[ -b $REALDEV ] ||mknod --mode 0600 $REALDEV b $DEVDEC"
$run_command "export PATH=/usr/bin:/bin:/sbin;mkdir /tmpmnt"
$run_command "export PATH=/usr/bin:/bin:/sbin;mount $DEV /tmpmnt"
$run_command "export PATH=/usr/bin:/bin:/sbin;mount $REALDEV /tmpmnt"
$run_command "export PATH=/usr/bin:/bin:/sbin;mkdir -p $CONTPATH"
$run_command "export PATH=/usr/bin:/bin:/sbin;mount -o bind /tmpmnt/$SUBROOT/$SUBPATH $CONTPATH"
$run_command "export PATH=/usr/bin:/bin:/sbin;umount /tmpmnt"
Expand Down

0 comments on commit 5524a29

Please sign in to comment.