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" return 1 fi } uo() { cd "overlay" if umount "mount"; then rmdir "mount" rm --recursive "upper" "work" if umount "lower"; then rmdir "lower" fi fi cd .. rmdir "overlay" } mr() { local f for f in "dev" "dev/pts" "proc" "sys"; do mount --bind "/${f}" "overlay/mount/${f}" done } alias cr="\ chroot \ \"overlay/mount\" \ " alias cru="\ chroot \ --userspec \"1000:1000\" \ \"overlay/mount\" \ " ur() { local f for f in "sys" "proc" "dev/pts" "dev"; do umount --lazy "overlay/mount/${f}" done } mm() { mount --make-rslave --rbind "/deb" "overlay/mount/deb" } um() { umount --recursive "overlay/mount/deb" } ms() { 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 }