ovl/squash

This commit is contained in:
Marc Beninca 2024-11-25 12:53:01 +01:00
parent c4b7796bb3
commit bb76a2f956
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -82,6 +82,26 @@ a__overlay_root_mount() {
) )
} }
ors() { a__overlay_root_squash "${@}"; }
a__overlay_root_squash() {
local directory="${1}"
local file
local level="${2}"
if [ -n "${directory}" ]; then
if mkdir "${directory}"; then
[ -n "${level}" ] || level="18"
for file in "vmlinuz" "initrd.img"; do
cp "overlay/mount/${file}" "${directory}"
done
mksquashfs \
"overlay/mount" "${directory}/filesystem.squashfs" \
-noappend \
-comp "zstd" -Xcompression-level "${level}"
chown --recursive 1000:1000 "${directory}"
fi
fi
}
oru() { a__overlay_root_unmount "${@}"; } oru() { a__overlay_root_unmount "${@}"; }
a__overlay_root_unmount() { a__overlay_root_unmount() {
( (
@ -118,23 +138,3 @@ a__overlay_root_unmount() {
return 7 return 7
fi fi
} }
ors() { a__overlay_root_squash "${@}"; }
a__overlay_root_squash() {
local directory="${1}"
local file
local level="${2}"
if [ -n "${directory}" ]; then
if mkdir "${directory}"; then
[ -n "${level}" ] || level="18"
for file in "vmlinuz" "initrd.img"; do
cp "overlay/mount/${file}" "${directory}"
done
mksquashfs \
"overlay/mount" "${directory}/filesystem.squashfs" \
-noappend \
-comp "zstd" -Xcompression-level "${level}"
chown --recursive 1000:1000 "${directory}"
fi
fi
}