(Un-)mount script

This commit is contained in:
Damian Pfammatter
2024-05-06 15:53:33 +02:00
parent 7bb870440d
commit 59ee4a0889
2 changed files with 25 additions and 6 deletions
+4 -6
View File
@@ -59,12 +59,10 @@ Execute the following instructions within the ARMHF guest system:
echo 1 | sudo tee /proc/sys/kernel/randomize_va_spac
```
- Chroot into the root filesystem:
```
sudo mount -t proc /proc/ $ROOTFS/proc/
sudo mount -t sysfs /sys/ $ROOTFS/sys/
sudo mount -o bind /dev/ $ROOTFS/dev/
sudo chroot $ROOTFS/ /bin/sh
export SHELL=/bin/sh
```shell
# Mount proc, sys and dev (use flag -u to unmount)
./mount.sh
sudo chroot $ROOTFS /usr/bin/env -i SHELL="/bin/ash" PS1="(r6700v3) # " /bin/ash
```
----------------------------------------------------------------------------------------------------
Executable
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# Parse command line arguments
unmount=false
while [[ "$#" -gt 0 ]]; do
case $1 in
-u) unmount=true;
esac
shift
done
# (Un-) mounting
if [ "$unmount" = true ]; then
sudo umount --recursive $ROOTFS/proc/
sudo umount --recursive $ROOTFS/sys/
sudo umount --recursive $ROOTFS/dev/
else
sudo mount -t proc /proc/ $ROOTFS/proc/
sudo mount -t sysfs /sys/ $ROOTFS/sys/
sudo mount -o bind /dev/ $ROOTFS/dev/
fi