Merging casper 1.162.
[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 /cdrom ]
34 then
35
36 cat > /root/usr/sbin/update-initramfs << EOF
37 #!/bin/sh
38
39 update-initramfs.distrib "$@"
40 cp /initrd.img /cdrom/live/initrd.gz
41 cp /vmlinuz /cdrom/live/vmlinuz
42 exit 0
43 EOF
44
45 else
46
47 cat > /root/usr/sbin/update-initramfs << EOF
48 #!/bin/sh
49
50 echo "update-initramfs is disabled since running on read-only media"
51 exit 0
52 EOF
53
54 fi
55
56 chmod 0755 /root/usr/sbin/update-initramfs
57
58 log_end_msg