Ubuntu Pastebin

Paste from ogra+ at Tue, 14 Jul 2015 14:04: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
31
32
33
34
35
36
37
38
39
40
41
        # 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

        # Request bootloader partition be mounted
        boot_partition=$(findfs LABEL="system-boot" 2>/dev/null || :)

        if [ -n "$boot_partition" ]; then
                # determine bootloader type
                grubdir="/boot/grub"
                ubootdir="/boot/uboot"

                # Since the boot partition is not required to actually boot
                # the image, request the init system handle it (fsck+mount).
                if [ -d "${rootmnt}/${grubdir}" ] && [ -e "${rootmnt}/usr/sbin/grub-install" ]; then
                        bootdir="$grubdir"

                        efidir="/boot/efi"
                        efibinddir="${efidir}/EFI/ubuntu/grub"
                        if [ -d "${rootmnt}/${efidir}" ]; then
                                echo "$boot_partition $efidir auto sync 0 2" >> "$fstab"
                                echo "$efibinddir $bootdir none bind 0 0" >> "$fstab"
                        fi
                else
                        bootdir="$ubootdir"

                        echo "$boot_partition $bootdir auto sync 0 2" >> "$fstab"
                fi
        fi
Download as text