SHA256
1
0
forked from pool/libguestfs
libguestfs/mount-rootfs-and-chroot.sh

46 lines
766 B
Bash
Raw Normal View History

- Update to version 1.54.0 (jsc#PED-8910) * Add detection of Circle Linux (Bella Zhang). * Add support for LoongArch (liuxiang). * Add detection of Kylin (grass-lu). * Add detection of openEuler (Wang Guoquan). * PARTUUID and PARTLABEL are now resolved in guest /etc/fstab. * New APIs findfs_partuuid and findfs_partlabel. These can be used to efficiently look up a filesystem by its GPT partition UUID or label. * Support for the following inactive or infrequently used device types has been removed: Gluster, Sheepdog, TFTP. * Add GOST R34.11-94 message digest algorithm to checksum APIs (Alexey Shabalin). * Allow nbd+unix:// URIs (NBD over Unix domain socket) in guestfish and other places. * Various part_* (partition) APIs related to GPT have been reimplemented to use util-linux sfdisk instead of sgdisk. Util-linux is more widely available, so this reduces dependencies in the common case. One optional API remains that still uses sgdisk. (Thanks Yongkui Guo). * Add cipher suboption to cryptsetup_open (Jonatan Pålsson). * Because of a bug, the part_get_gpt_attributes API could truncate the return value from 64 to 32 bits. This has been fixed. * Libguestfs will now no longer recommend using LIBGUESTFS_BACKEND=direct. This was shown previously when libvirt failed to start the appliance. However it is felt that this now does more harm than good. * Fix generation of virt-customize --chown parameter (Yongkui Guo) * In the appliance, reduce boot time when dhcp isn't needed OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=589
2024-10-10 13:30:33 +00:00
#!/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