libguestfs/mount-rootfs-and-chroot.sh
Charles Arnold b0d567393a - Update to version 1.55.2 (jsc#PED-8910)
* lib/inspect-osinfo.c: Add Windows Server 2025 osinfo
  * appliance: Use stable owner, group and mtime in appliance
    tarballs
  * mltools: Replace jansson with json-c
  * lib/info.c: Replace jansson with json-c
  * lib/qemu.c: Replace jansson with json-c
  * lib: direct: Remove test for qemu mandatory locking
  * Various language translations
  * Fix dhcpcd failing on systemd-resolved stub
  * mlcustomize: Add heuristic support for Windows Server 2025
  * mlcustomize/customize_run.ml: Move 'in' to new line
  * mlstdutils/guestfs_config: Define host_os
  * mlcustomize, mltools: Check guest OS is compatible before
    allowing --run
  * generator: Remove common/mlv2v/uefi.ml{,i} files
  * qemuopts: Add ability to add raw, unquoted output to qemu
    scripts
  * qemuopts: Fix missing break statement
  * mlstdutils: Remove Option module
  * Remove test for caml_alloc_initialized_string
  * build: Move baseline OCaml to 4.08

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=593
2025-01-03 22:42:14 +00:00

46 lines
766 B
Bash

#!/bin/bash
# Usage: $0 /dev/sda5
rootfs=$1
mnt=/sysroot
mounts=
if test -b "${rootfs}"
then
mkdir -v -p "${mnt}"
if mount -v "${rootfs}" "${mnt}"
then
for i in dev dev/pts proc sys selinux
do
if test -d /${i} && test -d "${mnt}/${i}" && test "`stat -c %D /`" != "`stat -c %D ${i}`"
then
mount -v --bind /${i} "${mnt}/${i}"
fi
done
chroot "${mnt}" su -
while read b m rest
do
case "${m}" in
${mnt}*)
mounts="${m} ${mounts}"
;;
esac
done <<-EOF
`
cat < /proc/mounts
`
EOF
for i in ${mounts}
do
umount -v "${i}"
done
fi
fi