diff --git a/shell/mount.sh b/shell/mount.sh index fe5b273..cb7bb5a 100644 --- a/shell/mount.sh +++ b/shell/mount.sh @@ -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 \