/usr/share/initramfs-tools/scripts/local-bottom/bootcdoverlayfs is in bootcd 5.04.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #!/bin/sh
# if necessary mount iso image loopback
# use overlayfs (either aufs or overlay) to make iso image "writable"
# See manpage initramfs-tools(8)
[ -f /scripts/functions ] && . /scripts/functions
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
# chkerr <EXIT CODE> <action performed>
chkerr()
{
e=$1
shift
if [ $e -ne 0 ]; then
echo "bootcdoverlayfs: ERROR $e while running: $*"
echo "try to fix and exit"
/bin/sh
fi
}
getiso()
{
sed -n "s/^.*\<root=iso:\([^ :]*\):\([^ ]*\)\>.*$/\2/p"
}
modprobe aufs || true
modprobe overlay || true
if [ "$(grep "\<bootcd=" /proc/cmdline)" ]; then
echo "bootcdoverlayfs rootmnt=<$rootmnt>"
iso="$(cat /proc/cmdline | getiso)"
if [ "$iso" ]; then
mkdir /bootcd.disk_with_iso
mount --move ${rootmnt} /bootcd.disk_with_iso
chkerr $? "mount --move ${rootmnt} /bootcd.disk_with_iso"
modprobe loop
mount -o loop -t iso9660 /bootcd.disk_with_iso/${iso} ${rootmnt}
chkerr $? "mount -o loop -t iso9660 /bootcd.disk_with_iso/${iso} ${rootmnt}"
fi
mkdir /bootcd.upper
mount tmpfs -t tmpfs /bootcd.upper
chkerr $? "mount none -t tmpfs /bootcd.upper"
mkdir /bootcd.lower
mount --move ${rootmnt} /bootcd.lower
chkerr $? "mount --move ${rootmnt} /bootcd.lower"
mkdir /overlayfs
if [ "$(cat /proc/filesystems | grep "\<aufs\>")" ]; then
mount aufs -t aufs -o dirs=/bootcd.upper:/bootcd.lower=ro /overlayfs
chkerr $? "mount aufs -t aufs -o dirs=/bootcd.upper:/bootcd.lower=ro /overlayfs"
elif [ "$(cat /proc/filesystems | grep "\<overlay\>")" ]; then
mkdir /bootcd.upper/upper
mkdir /bootcd.upper/work
mount overlay -t overlay -o lowerdir=/bootcd.lower,upperdir=/bootcd.upper/upper,workdir=/bootcd.upper/work /overlayfs
chkerr $? "mount overlay -t overlay -o lowerdir=/bootcd.lower,upperdir=/bootcd.upper/upper,workdir=/bootcd.upper/work /overlayfs"
else
chkerr 1 "no aufs and no overlay in /proc/filesystems"
fi
mkdir -p /overlayfs/mnt/bootcd.lower
mount --move /bootcd.lower /overlayfs/mnt/bootcd.lower
chkerr $? "mount --move /bootcd /overlayfs/mnt/bootcd.lower"
if [ "$iso" ]; then
mkdir -p /overlayfs/mnt/bootcd.disk_with_iso
mount --move /bootcd.disk_with_iso /overlayfs/mnt/bootcd.disk_with_iso
chkerr $? "mount --move /bootcd.disk_with_iso /overlayfs/mnt/bootcd.disk_with_iso"
fi
mkdir -p /overlayfs/mnt/bootcd.upper
mount --move /bootcd.upper /overlayfs/mnt/bootcd.upper
chkerr $? "mount --move /bootcd.upper /overlayfs/mnt/bootcd.upper"
mount --move /overlayfs ${rootmnt}
chkerr $? "mount --move /overlayfs ${rootmnt}"
fi
exit 0
|