Ubuntu Pastebin

Paste from ogra at Tue, 15 Sep 2015 09:25:28 +0000

Download as text
 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
    # Mount and umount first to let the kernel handle
    # the journal and orphaned inodes (much faster than e2fsck).
    mount -o errors=remount-ro "$path" "$writable_mnt" || true
    umount "$writable_mnt" || true

    # Automatically fix errors
    /sbin/e2fsck -va "$path" >> "$logfile" 2>&1 || true

    echo "$(date '+%s'): end" >> "$logfile" || true

    echo "initrd: mounting $writable_label partition" >/dev/kmsg || true
    mount "$path" "$writable_mnt"
    mkdir -p "${rootmnt}/writable"
    mount --move "$writable_mnt" "${rootmnt}/writable"

    # Prepare the fstab
    fstab="${rootmnt}/etc/fstab"
    writable_paths="${rootmnt}/etc/system-image/writable-paths"

    # Add writable overlays
    if [ -e "$writable_paths" ]; then
        touch "${rootmnt}/run/image.fstab"
        mount -o bind "${rootmnt}/run/image.fstab" "$fstab" || panic "Cannot bind mount fstab"
        echo "# Auto-generated by $0" >> "$fstab"
        echo "# DO NOT EDIT THIS FILE BY HAND - YOUR CHANGES WILL BE OVERWRITTEN" >> "$fstab"
        echo "# (See writable-paths(5) for details)" >> "$fstab"
        echo "/dev/root / rootfs defaults,ro 0 0" >> "$fstab"

        handle_writable_paths "$writable_paths" "$fstab"
    fi
Download as text