79 lines
1.5 KiB
Bash
79 lines
1.5 KiB
Bash
alias m='mount'
|
|
|
|
# remount read-only medium in read-write
|
|
alias remount='mount -o remount,rw /usr/lib/live/mount/medium'
|
|
|
|
|
|
function mo {
|
|
local directory="${1}"
|
|
local file
|
|
if [ "${directory}" ] ; then
|
|
directory="$(realpath "${directory}")"
|
|
file="${directory}/filesystem.squashfs"
|
|
if mkdir 'overlay' ; then
|
|
cd 'overlay'
|
|
mkdir {lower,upper,work,mount}
|
|
if mount "${file}" 'lower' ; then
|
|
mount -t 'overlay' 'overlay' 'mount' \
|
|
-o lowerdir='lower',upperdir='upper',workdir='work'
|
|
fi
|
|
cd ..
|
|
fi
|
|
else
|
|
echo 'KO: directory?'
|
|
fi
|
|
}
|
|
|
|
function uo {
|
|
cd 'overlay'
|
|
if umount 'mount' ; then
|
|
rmdir 'mount'
|
|
rm --recursive 'upper' 'work'
|
|
if umount 'lower' ; then
|
|
rmdir 'lower'
|
|
fi
|
|
fi
|
|
cd ..
|
|
rmdir 'overlay'
|
|
}
|
|
|
|
|
|
function mr {
|
|
for f in 'dev' 'dev/pts' 'proc' 'sys' ; do
|
|
mount --bind "/${f}" "overlay/mount/${f}"
|
|
done
|
|
}
|
|
|
|
alias cr='chroot overlay/mount'
|
|
|
|
function ur {
|
|
for f in 'dev/pts' 'dev' 'proc' 'sys' ; do
|
|
umount --lazy "overlay/mount/${f}"
|
|
done
|
|
}
|
|
|
|
|
|
function mm {
|
|
mount --bind '/deb' 'overlay/mount/deb'
|
|
}
|
|
|
|
function um {
|
|
umount 'overlay/mount/deb'
|
|
}
|
|
|
|
|
|
function ms {
|
|
local directory="${1}"
|
|
local level="${2}"
|
|
if [ "${directory}" ] ; then
|
|
if mkdir "${directory}" ; then
|
|
[ "${level}" ] || level='18'
|
|
cp overlay/mount/{vmlinuz,initrd.img} "${directory}"
|
|
mksquashfs \
|
|
'overlay/mount' "${directory}/filesystem.squashfs" \
|
|
-b '1M' \
|
|
-comp 'zstd' -Xcompression-level "${level}"
|
|
chown --recursive 1000:1000 "${directory}"
|
|
fi
|
|
fi
|
|
}
|