summaryrefslogtreecommitdiff
path: root/scripts/live-bottom/43disable_updateinitramfs
blob: 6ceeacfa09488540ffda83be85d9296d4f9b502b (plain)
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
#!/bin/sh

#set -e

# initramfs-tools header

PREREQ=""

prereqs()
{
	echo "${PREREQ}"
}

case "${1}" in
	prereqs)
		prereqs
		exit 0
		;;
esac

# live-initramfs header

. /scripts/live-functions

log_begin_msg "Possibly disabling update-initramfs (useless on a live CD)..."

# live-initramfs script

chroot /root dpkg-divert --add --rename --quiet \
	/usr/sbin/update-initramfs

# Running off a USB disk or other writable media.
if [ -w /root/cdrom ] && \
   ! grep -q '^[^ ]* /root/cdrom [^ ]* [^ ]*\<ro\>' /proc/mounts
then

cat > /root/usr/sbin/update-initramfs << 'EOF'
#!/bin/sh

update-initramfs.distrib "$@"
cp /initrd.img /cdrom/live/initrd.gz
cp /vmlinuz /cdrom/live/vmlinuz
exit 0
EOF

else

cat > /root/usr/sbin/update-initramfs << EOF
#!/bin/sh

echo "update-initramfs is disabled since running on read-only media"
exit 0
EOF

fi

chmod 0755 /root/usr/sbin/update-initramfs

log_end_msg