Adding upstream version 1.236.2.
[live-boot-grml.git] / scripts / live-bottom / 43disable_updateinitramfs
index 6ceeacf..44e2d1f 100755 (executable)
@@ -31,15 +31,29 @@ chroot /root dpkg-divert --add --rename --quiet \
 
 # Running off a USB disk or other writable media.
 if [ -w /root/cdrom ] && \
-   ! grep -q '^[^ ]* /root/cdrom [^ ]* [^ ]*\<ro\>' /proc/mounts
+   # rw is guaranteed to be first.
+   grep -q ' /root/cdrom rw[, ]' /proc/self/mountinfo
 then
 
 cat > /root/usr/sbin/update-initramfs << 'EOF'
 #!/bin/sh
 
+set -e
+
 update-initramfs.distrib "$@"
-cp /initrd.img /cdrom/live/initrd.gz
-cp /vmlinuz /cdrom/live/vmlinuz
+
+if [ -e /cdrom/live/initrd.lz ]
+then
+       zcat /initrd.img | lzma -9c >/cdrom/live/initrd.lz.new
+       mv /cdrom/live/initrd.lz.new /cdrom/live/initrd.lz
+else
+       cp /initrd.img /cdrom/live/initrd.gz.new
+       mv /cdrom/live/initrd.gz.new /cdrom/live/initrd.gz
+fi
+
+cp /vmlinuz /cdrom/live/vmlinuz.new
+mv /cdrom/live/vmlinuz.new /cdrom/live/vmlinuz
+
 exit 0
 EOF