This commit is contained in:
Marc Beninca 2024-11-16 04:04:44 +01:00
parent 2b807632b3
commit 36aaa275a7
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,26 +1,39 @@
mo() {
local root="${1}"
local directory file
if [ -n "${root}" ]; then
root="$(realpath "${root}")"
file="${root}/filesystem.squashfs"
if mkdir "overlay"; then
cd "overlay"
for directory in "lower" "upper" "work" "mount"; do
mkdir "${directory}"
done
if mount "${file}" "lower"; then
mount \
-o lowerdir="lower",upperdir="upper",workdir="work" \
-t "overlay" \
"overlay" "mount"
fi
cd ..
fi
else
log_fatal "No root"
if [ -z "${root}" ]; then
log_error "No root"
return 1
fi
root="$(realpath "${root}")"
if ! mkdir "overlay"; then
log_error "Unable to make mount directory"
return 2
fi
{
if ! cd "overlay"; then
log_error "Unable to move into mount directory"
return 3
fi
local directory
for directory in "lower" "upper" "work" "mount"; do
if ! mkdir --parents "${directory}"; then
log_error "Unable to move into: ${directory}"
return 4
fi
done
local file="${root}/filesystem.squashfs"
if ! mount "${file}" "lower"; then
log_error "Unable to mount: ${file}"
return 5
fi
if ! mount \
-o "lowerdir=lower,upperdir=upper,workdir=work" \
-t "overlay" \
"overlay" "mount"; then
log_error "Unable to mount: ${file}"
return 6
fi
}
}
uo() {