This commit is contained in:
Marc Beninca 2024-11-25 12:49:17 +01:00
parent a52d3595f7
commit 6b8da7e16b
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,4 +1,5 @@
mo() { orm() { a__overlay_root_mount "${@}"; }
a__overlay_root_mount() {
local root="${1}" local root="${1}"
if [ -z "${root}" ]; then if [ -z "${root}" ]; then
sh_log_error "No root target directory" sh_log_error "No root target directory"
@ -36,7 +37,8 @@ mo() {
) )
} }
uo() { oru() { a__overlay_root_unmount "${@}"; }
a__overlay_root_unmount() {
( (
if ! cd "overlay"; then if ! cd "overlay"; then
sh_log_error "Unable to move into overlay directory" sh_log_error "Unable to move into overlay directory"
@ -72,7 +74,8 @@ uo() {
fi fi
} }
mr() { obm() { a__overlay_bind_mount "${@}"; }
a__overlay_bind_mount() {
local directory local directory
for directory in "dev" "dev/pts" "proc" "sys"; do for directory in "dev" "dev/pts" "proc" "sys"; do
if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then
@ -82,18 +85,21 @@ mr() {
done done
} }
cr() { ocr() { a__overlay_command_root "${@}"; }
a__overlay_command_root() {
chroot \ chroot \
"overlay/mount" "${@}" "overlay/mount" "${@}"
} }
cru() { ocu() { a__overlay_command_user "${@}"; }
a__overlay_command_user() {
chroot \ chroot \
--userspec "1000:1000" \ --userspec "1000:1000" \
"overlay/mount" "${@}" "overlay/mount" "${@}"
} }
ur() { obu() { a__overlay_bind_unmount "${@}"; }
a__overlay_bind_unmount() {
local directory local directory
for directory in "sys" "proc" "dev/pts" "dev"; do for directory in "sys" "proc" "dev/pts" "dev"; do
if ! umount --lazy "overlay/mount/${directory}"; then if ! umount --lazy "overlay/mount/${directory}"; then
@ -103,15 +109,18 @@ ur() {
done done
} }
mm() { omm() { a__overlay_mirror_mount "${@}"; }
a__overlay_mirror_mount() {
mount --make-rslave --rbind "/deb" "overlay/mount/deb" mount --make-rslave --rbind "/deb" "overlay/mount/deb"
} }
um() { omu() { a__overlay_mirror_unmount "${@}"; }
a__overlay_mirror_unmount() {
umount --recursive "overlay/mount/deb" umount --recursive "overlay/mount/deb"
} }
ms() { ors() { a__overlay_root_squash "${@}"; }
a__overlay_root_squash() {
local directory="${1}" local directory="${1}"
local file local file
local level="${2}" local level="${2}"