Commit 3101e8d9 authored by Gerardo Exequiel Pozzi's avatar Gerardo Exequiel Pozzi
Browse files

[archiso] Create correctly loop devs if loop.max_part > 0


Signed-off-by: default avatarGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
parent 729e110e
# Initialize loopback device logic (we using on-demand mode)
# args: none
_init_loop_dev() {
loop_dev_cnt=99
modprobe loop
loop_dev_count=99
loop_dev_range=$(cat /sys/block/loop0/range)
loop_dev_minor=$((loop_dev_count*loop_dev_range))
}
# Call this function before _make_loop_dev() each time.
# args: none
_next_loop_dev() {
loop_dev_cnt=$((loop_dev_cnt+1))
loop_dev_count=$((loop_dev_count+1))
loop_dev_minor=$((loop_dev_count*loop_dev_range))
}
# Setup a loopback device for image passed as arguemnt and echo the path to loopback device used.
# Setup a loopback device for image passed as argument and echo the path to loopback device used.
# args: /path/to/image_file
_make_loop_dev() {
local img="${1}"
mknod /dev/loop${loop_dev_cnt} b 7 ${loop_dev_cnt} &> /dev/null
losetup /dev/loop${loop_dev_cnt} "${img}" &> /dev/null
echo /dev/loop${loop_dev_cnt}
mknod /dev/loop${loop_dev_count} b 7 ${loop_dev_minor} &> /dev/null
losetup /dev/loop${loop_dev_count} "${img}" &> /dev/null
echo /dev/loop${loop_dev_count}
}
# args: source, mountpoint
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment