directories & files

This commit is contained in:
Marc Beninca 2024-11-16 03:34:01 +01:00
parent 964df6e8dc
commit 2b807632b3
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,12 +1,14 @@
mo() {
local directory="${1}"
local file
if [ -n "${directory}" ]; then
directory="$(realpath "${directory}")"
file="${directory}/filesystem.squashfs"
local root="${1}"
local directory file
if [ -n "${root}" ]; then
root="$(realpath "${root}")"
file="${root}/filesystem.squashfs"
if mkdir "overlay"; then
cd "overlay"
mkdir {lower,upper,work,mount}
for directory in "lower" "upper" "work" "mount"; do
mkdir "${directory}"
done
if mount "${file}" "lower"; then
mount \
-o lowerdir="lower",upperdir="upper",workdir="work" \
@ -16,7 +18,8 @@ mo() {
cd ..
fi
else
echo "KO: directory?"
log_fatal "No root"
return 1
fi
}
@ -68,11 +71,14 @@ um() {
ms() {
local directory="${1}"
local file
local level="${2}"
if [ -n "${directory}" ]; then
if mkdir "${directory}"; then
[ -n "${level}" ] || level="18"
cp overlay/mount/{vmlinuz,initrd.img} "${directory}"
for file in "vmlinuz" "initrd.img"; do
cp "overlay/mount/${file}" "${directory}"
done
mksquashfs \
"overlay/mount" "${directory}/filesystem.squashfs" \
-noappend \