/bin/live-update-initramfs is in live-tools 4.0.2-1.1.
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 | #!/bin/sh
## live-tools(7) - System Support Scripts
## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
set -e
if [ ! -e /usr/sbin/update-initramfs.orig.initramfs-tools ]
then
echo "E: /usr/sbin/update-initramfs.orig.initramfs-tools - command not found"
echo "E: On Debian based systems, update-initramfs from initramfs-tools"
echo "E: can be installed with:"
echo "E: apt-get install initramfs-tools"
exit 1
fi
# system is a live system and not a system in the process of being built by live-build
if [ ! -e /.live-build ] && grep -qs "boot=live" /proc/cmdline
then
if grep -qs "\/lib\/live\/mount\/medium" /proc/mounts
then
# live system with live media mounted as /lib/live/mount/medium
_DEVICE="$(awk '/\/lib\/live\/mount\/medium/ { print $1 }' /proc/mounts)"
mount -o remount,rw ${_DEVICE} > /dev/null 2>&1 || true
if touch /lib/live/mount/medium/.test > /dev/null 2>&1
then
_READ_WRITE="true"
rm -f /lib/live/mount/medium/.test
else
_READ_WRITE="false"
fi
else
# live system without live media mounted as /lib/live/mount/medium
echo "I: update-initramfs is disabled (live system is running without media mounted on /lib/live/mount/medium)."
exit 0
fi
else
# non-live system
/usr/sbin/update-initramfs.orig.initramfs-tools "${@}"
exit "${?}"
fi
case "${_READ_WRITE}" in
true)
# Updating initramfs
/usr/sbin/update-initramfs.orig.initramfs-tools "${@}"
# FIXME: needs to exclude initrd backup files
if [ "$(ls /boot/initrd.img-* | wc -l)" -gt 1 ]
then
_NUMBER="1"
for _INITRD in /boot/initrd.img-*
do
_VERSION="$(basename ${_INITRD} | sed -e 's|initrd.img-||')"
cp /boot/vmlinuz-${_VERSION} /lib/live/mount/medium/live/vmlinuz${_NUMBER}.new
cp /boot/initrd.img-${_VERSION} /lib/live/mount/medium/live/initrd${_NUMBER}.img.new
mv /lib/live/mount/medium/live/vmlinuz${_NUMBER}.new /lib/live/mount/medium/live/vmlinuz${_NUMBER}
mv /lib/live/mount/medium/live/initrd${_NUMBER}.img.new /lib/live/mount/medium/live/initrd${_NUMBER}.img
_NUMBER="$((${_NUMBER} + 1))"
done
else
cp /boot/vmlinuz-* /lib/live/mount/medium/live/vmlinuz.new
cp /boot/initrd.img-* /lib/live/mount/medium/live/initrd.img.new
mv /lib/live/mount/medium/live/vmlinuz.new /lib/live/mount/medium/live/vmlinuz
mv /lib/live/mount/medium/live/initrd.img.new /lib/live/mount/medium/live/initrd.img
fi
;;
false)
echo "I: update-initramfs is disabled (live system is running on read-only media)."
exit 0
;;
esac
|