feat: Vfs and Ext2 support. Code style/attribute improvements
Added VFS and Ext2 support. Optimized attributes of methods to improve code highlighting. Printf attribute, malloc attribute, etc.
This commit is contained in:
39
rootfs/mount_rootfs.sh
Executable file
39
rootfs/mount_rootfs.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
IMG_FILE=rootfs.img
|
||||
IMG_SIZE=100 # MB
|
||||
|
||||
function log() {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
function yes_or_no() {
|
||||
while true; do
|
||||
read -p "$* [y/n]: " yn
|
||||
case $yn in
|
||||
[Yy]*) return 0 ;;
|
||||
[Nn]*)
|
||||
echo "Aborted"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function setup_lb() {
|
||||
sudo losetup -fP --show ${IMG_FILE}
|
||||
}
|
||||
|
||||
if [ ! -f "${IMG_FILE}" ]; then
|
||||
log "${IMG_FILE} doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LB_DEV="$(setup_lb)"
|
||||
|
||||
if [ -z "${LB_DEV}" ]; then
|
||||
log "Failed to setup loobback"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo mount "${LB_DEV}p1" mnt
|
||||
Reference in New Issue
Block a user