#!/bin/sh # remount EVMS-created volumes # see https://bugzilla.altlinux.org/28181 ME=11-remount exec 2>/tmp/"$ME".log >&2 . install2-init-functions sync # these are normally missing in installer environment # NB: /sbin writes rely on aufs in fact, would use /tmp otherwise # but that might clobber cases when the binaries have to differ for i in /sbin/{mdadm,lvm}; do if [ ! -x "$i" -a -x "$destdir$i" ]; then cp -p "$destdir$i" "$i" fi done if [ -f "$destdir/etc/lvm/lvm.conf" ]; then mkdir -p /etc/lvm && cp -p "$destdir/etc/lvm/lvm.conf" /etc/lvm fi umount "$destdir/dev/pts" chroot "$destdir" umount -a grep " $destdir" /proc/mounts | while read dev mnt rest; do umount "$mnt"; done umount "$destdir" || exit 1 # avoid automatic rpm shell.req dependency MDADM=/sbin/mdadm LVM=/sbin/lvm if [ -f /proc/mdstat -a -x "$MDADM" ]; then "$MDADM" --examine --scan > /tmp/mdadm.conf "$MDADM" --stop --scan fi # evms_deactivate does essentially the same but is normally missing dmsetup remove_all if [ -s /tmp/mdadm.conf -a -x "$MDADM" ]; then # suitable arbitrary value of the year: packages already installed sysctl -w dev.raid.speed_limit_max=1000000 "$MDADM" --assemble --run --scan --config=/tmp/mdadm.conf fi if [ -x "$LVM" ]; then "$LVM" pvscan "$LVM" vgscan "$LVM" vgchange -ay --noudevsync fi # created by 10-fstab.sh rootfs="$(awk '{ if ($2=="/") print $1 }' < /tmp/fstab)" case "$rootfs" in UUID=*) mount "`blkid -U ${rootfs#UUID=}`" $destdir ;; LABEL=*) mount "`blkid -L ${rootfs#LABEL=}`" $destdir ;; /*) mount "$rootfs" "$destdir" ;; *) echo "$ME.sh: unknown rootfs: $rootfs" >&2 exit 2 ;; esac mount -o bind /dev $destdir/dev mount -t sysfs sysfs "$destdir/sys" mount -t proc proc "$destdir/proc" chroot "$destdir" mount -a ||: # NB: use "sleep 3600" here to debug :)