libguestfs/mount-rootfs-and-chroot.sh
Charles Arnold cfb3d2ae67 - Update to version 1.53.5 (jsc#PED-6305)
* generator/customize.ml: Split --chown parameter on ':' character
  * daemon: Add gost checksum command support
  * Add detection support for Circle Linux
  * Add support for LoongArch.
  * daemon: Fix file architecture translation for LoongArch
  * options: Allow nbd+unix:// URIs
  * daemon/parted: Assume sfdisk --part-type exists
  * daemon: Reimplement partition GPT functions using sfdisk
  * appliance: only wait for resolv.conf update if dhcpcd succeeded
  * generator/customize.ml: Add virt-customize --inject-blnsvr operation
  * lib: libvirt: Stop recommending LIBGUESTFS_BACKEND=direct
  * daemon: cryptsetup_open: Add --cipher
  * rust: Handle null pointer when creating slice
  * Remove gluster support
  * Remove sheepdog support
  * Remove tftp drive support
  * generator/daemon: Don't truncate 64 bit results from OCaml functions
  * daemon: Fix parsing in part_get_gpt_attributes
  * New APIs: findfs_partuuid and findfs_partlabel
  * inspection: Resolve PARTUUID= and PARTLABEL= in /etc/fstab
  * generator/actions_core.ml: Fix version field for new APIs
  * Kylin is centos derivative

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=585
2024-07-16 19:35:58 +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