~darkxst/casper/ubuntu-gnome-casper-tweaks

« back to all changes in this revision

Viewing changes to scripts/casper-bottom/43disable_updateinitramfs

  • Committer: Stéphane Graber
  • Date: 2012-10-02 19:48:18 UTC
  • Revision ID: stgraber@ubuntu.com-20121002194818-pnw7i6er2lp79yff
Only write /usr/sbin/update-initramfs if it doesn't already exist.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
chroot /root dpkg-divert --add --rename --quiet \
25
25
        /usr/sbin/update-initramfs
 
26
 
26
27
# Running off a USB disk or other writable media.
27
 
if [ -w /root/cdrom ] && \
28
 
   # rw is guaranteed to be first.
29
 
   grep -q ' /root/cdrom rw[, ]' /proc/self/mountinfo; then
30
 
        ln -s /usr/share/casper/casper-update-initramfs \
31
 
              /root/usr/sbin/update-initramfs
32
 
else
33
 
        cat > /root/usr/sbin/update-initramfs <<EOF
 
28
if [ ! -e /root/usr/sbin/update-initramfs ] && \
 
29
   [ ! -L /root/usr/sbin/update-initramfs ]; then
 
30
    if [ -w /root/cdrom ] && \
 
31
       # rw is guaranteed to be first.
 
32
       grep -q ' /root/cdrom rw[, ]' /proc/self/mountinfo; then
 
33
 
 
34
        ln -s /usr/share/casper/casper-update-initramfs \
 
35
            /root/usr/sbin/update-initramfs
 
36
    else
 
37
        cat > /root/usr/sbin/update-initramfs <<EOF
34
38
#! /bin/sh
35
39
echo "update-initramfs is disabled since running on read-only media"
36
40
exit 0
37
41
EOF
38
 
        chmod 755 /root/usr/sbin/update-initramfs
 
42
        chmod 755 /root/usr/sbin/update-initramfs
 
43
    fi
39
44
fi
40
45
 
41
46
log_end_msg