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