forked from pool/libguestfs
- Update to version 1.55.4 (jsc#PED-8910)
* appliance/init: Fix /usr/sbin symlinks in Fedora 42+ * Various translation updates OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=597
This commit is contained in:
45
mount-rootfs-and-chroot.sh
Normal file
45
mount-rootfs-and-chroot.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user