/bin/live-medium-cache is in live-tools 1:20151214+nmu1.
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 | #!/bin/sh
# live-tools(7) - System Support Scripts
# Copyright (C) 2006-2015 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
# Exit if system is not a live system
if ! grep -qs "boot=live" /proc/cmdline || \
# Exit if system is toram
grep -qs "toram" /proc/cmdline
then
exit 0
fi
# Try to cache everything we're likely to need after ejecting. This
# is fragile and simple-minded, but our options are limited.
cache_path()
{
path="${1}"
if [ -d "${path}" ]
then
find "${path}" -type f | xargs cat > /dev/null 2>&1
elif [ -f "${path}" ]
then
if [ -x /usr/bin/file ] && file -L "${path}" | grep -q 'dynamically linked'
then
# ldd output can be of three forms:
# 1. linux-vdso.so.1 => (0x00007fffe3fb4000)
# This is a virtual, kernel shared library and we want to skip it
# 2. libc.so.6 => /lib/libc.so.6 (0x00007f5e9dc0c000)
# We want to cache the third word.
# 3. /lib64/ld-linux-x86-64.so.2 (0x00007f5e9df8b000)
# We want to cache the first word.
ldd "${path}" | while read line
do
if echo "$line" | grep -qs ' => '
then
continue
elif echo "$line" | grep -qs ' => '
then
lib=$(echo "${line}" | awk '{ print $3 }')
else
lib=$(echo "${line}" | awk '{ print $1 }')
fi
cache_path "${lib}"
done
fi
cat "${path}" >/dev/null 2>&1
fi
}
echo "live-tools: caching reboot files..."
prompt=1
case "${NOPROMPT}" in
yes)
prompt=
;;
esac
for path in $(which halt) $(which reboot) /etc/rc?.d /etc/default $(which stty) /bin/plymouth
do
cache_path "${path}"
done
mount -o remount,ro /lib/live/mount/overlay > /dev/null 2>&1
# Remounting any persistence devices read-only
for _MOUNT in $(awk '/\/lib\/live\/mount\/persistence/ { print $2 }' /proc/mounts)
do
mount -o remount,ro ${_MOUNT} > /dev/null 2>&1
done
# Flush filesystem buffers
sync
|