Merging casper 1.172.
[live-boot-grml.git] / scripts / live-bottom / 43disable_updateinitramfs
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 . /scripts/live-functions
24
25 log_begin_msg "Possibly disabling update-initramfs (useless on a live CD)..."
26
27 # live-initramfs script
28
29 chroot /root dpkg-divert --add --rename --quiet \
30         /usr/sbin/update-initramfs
31
32 # Running off a USB disk or other writable media.
33 if [ -w /root/cdrom ] && \
34    ! grep -q '^[^ ]* /root/cdrom [^ ]* [^ ]*\<ro\>' /proc/mounts
35 then
36
37 cat > /root/usr/sbin/update-initramfs << 'EOF'
38 #!/bin/sh
39
40 update-initramfs.distrib "$@"
41 cp /initrd.img /cdrom/live/initrd.gz
42 cp /vmlinuz /cdrom/live/vmlinuz
43 exit 0
44 EOF
45
46 else
47
48 cat > /root/usr/sbin/update-initramfs << EOF
49 #!/bin/sh
50
51 echo "update-initramfs is disabled since running on read-only media"
52 exit 0
53 EOF
54
55 fi
56
57 chmod 0755 /root/usr/sbin/update-initramfs
58
59 log_end_msg