~snappy-dev/snappy-hub/snappy-systems

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
set default=0
set timeout=3

insmod part_gpt
insmod ext2

if [ -s $prefix/grubenv ]; then
  load_env
fi

if [ "$snap_mode" = "try" ]; then
    # a new core or kernel got installed
    set snap_mode="trying"
    save_env snap_mode

    if [ x"$snap_try_core" != x"" ]; then
        set snap_core="$snap_try_core"
    fi
    if [ x"$snap_try_kernel" != x"" ]; then
        set snap_kernel="$snap_try_kernel"
    fi
elif [ "$snap_mode" = "trying" ]; then
    # nothing cleared the "trying snap" so the boot failed
    # we clear the mode and boot normally
    set snap_mode=""
    save_env snap_mode
fi

set label="writable"
set cmdline="root=LABEL=$label snap_core=$snap_core snap_kernel=$snap_kernel ro net.ifnames=0 init=/lib/systemd/systemd console=ttyS0 console=tty1 panic=-1"

menuentry "Ubuntu Core 16" {
    search --label $label --set=writable
    loopback loop ($writable)/system-data/var/lib/snapd/snaps/$snap_kernel
    linux (loop)/kernel.img $cmdline
    initrd (loop)/initrd.img
}