Merge lp:~sergiusens/snappy-hub/grubcfg into lp:~snappy-dev/snappy-hub/snappy-systems

Proposed by Sergio Schvezov
Status: Merged
Approved by: John Lenton
Approved revision: 4
Merged at revision: 3
Proposed branch: lp:~sergiusens/snappy-hub/grubcfg
Merge into: lp:~snappy-dev/snappy-hub/snappy-systems
Diff against target: 157 lines (+116/-2)
4 files modified
generic-amd64/grub.cfg (+54/-0)
generic-amd64/meta/package.yaml (+4/-1)
generic-i386/grub.cfg (+54/-0)
generic-i386/meta/package.yaml (+4/-1)
To merge this branch: bzr merge lp:~sergiusens/snappy-hub/grubcfg
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Sergio Schvezov Approve
Review via email: mp+262701@code.launchpad.net

Commit message

grub.cfg for generic-amd64

To post a comment you must log in.
lp:~sergiusens/snappy-hub/grubcfg updated
4. By Sergio Schvezov

updating grub.cfg, using the same file for i386

Revision history for this message
Sergio Schvezov (sergiusens) :
review: Approve
Revision history for this message
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'generic-amd64/grub.cfg'
2--- generic-amd64/grub.cfg 1970-01-01 00:00:00 +0000
3+++ generic-amd64/grub.cfg 2015-06-30 11:19:14 +0000
4@@ -0,0 +1,54 @@
5+set default=0
6+set timeout=3
7+
8+insmod part_gpt
9+insmod ext2
10+
11+if [ -s $prefix/grubenv ]; then
12+ load_env
13+fi
14+
15+if [ -z "$snappy_mode" ]; then
16+ set snappy_mode=regular
17+ save_env snappy_mode
18+fi
19+if [ -z "$snappy_ab" ]; then
20+ set snappy_ab=a
21+ save_env snappy_ab
22+fi
23+
24+if [ "$snappy_mode" = "try" ]; then
25+ if [ "$snappy_trial_boot" = "1" ]; then
26+ # Previous boot failed to unset snappy_trial_boot, so toggle
27+ # rootfs.
28+ if [ "$snappy_ab" = "a" ]; then
29+ set snappy_ab=b
30+ else
31+ set snappy_ab=a
32+ fi
33+ save_env snappy_ab
34+ else
35+ # Trial mode so set the snappy_trial_boot (which snappy is
36+ # expected to unset).
37+ #
38+ # Note: don't use the standard recordfail variable since that forces
39+ # the menu to be displayed and sets an infinite timeout if set.
40+ set snappy_trial_boot=1
41+ save_env snappy_trial_boot
42+ fi
43+fi
44+
45+set label="system-$snappy_ab"
46+set cmdline="root=LABEL=$label ro init=/lib/systemd/systemd console=tty1 console=ttyS0 panic=-1"
47+
48+menuentry "$label" {
49+ if [ -d "$prefix/$snappy_ab" ]; then
50+ linux $prefix/$snappy_ab/vmlinuz $cmdline
51+ initrd $prefix/$snappy_ab/initrd.img
52+ else
53+ # old-style kernel-in-os-partition
54+ search --no-floppy --set --label "$label"
55+ linux /vmlinuz $cmdline
56+ initrd /initrd.img
57+ fi
58+}
59
60=== modified file 'generic-amd64/meta/package.yaml'
61--- generic-amd64/meta/package.yaml 2015-04-22 15:46:27 +0000
62+++ generic-amd64/meta/package.yaml 2015-06-30 11:19:14 +0000
63@@ -1,7 +1,7 @@
64 name: generic-amd64
65 vendor: Sergio Schvezov <sergio.schvezov@canonical.com>
66 icon: meta/ubuntu.png
67-version: 1.1
68+version: 1.2
69 type: oem
70
71 config:
72@@ -17,3 +17,6 @@
73 bootloader: grub
74 architecture: amd64
75 partition-layout: system-AB
76+ boot-assets:
77+ files:
78+ - path: grub.cfg
79
80=== added file 'generic-i386/grub.cfg'
81--- generic-i386/grub.cfg 1970-01-01 00:00:00 +0000
82+++ generic-i386/grub.cfg 2015-06-30 11:19:14 +0000
83@@ -0,0 +1,54 @@
84+set default=0
85+set timeout=3
86+
87+insmod part_gpt
88+insmod ext2
89+
90+if [ -s $prefix/grubenv ]; then
91+ load_env
92+fi
93+
94+if [ -z "$snappy_mode" ]; then
95+ set snappy_mode=regular
96+ save_env snappy_mode
97+fi
98+if [ -z "$snappy_ab" ]; then
99+ set snappy_ab=a
100+ save_env snappy_ab
101+fi
102+
103+if [ "$snappy_mode" = "try" ]; then
104+ if [ "$snappy_trial_boot" = "1" ]; then
105+ # Previous boot failed to unset snappy_trial_boot, so toggle
106+ # rootfs.
107+ if [ "$snappy_ab" = "a" ]; then
108+ set snappy_ab=b
109+ else
110+ set snappy_ab=a
111+ fi
112+ save_env snappy_ab
113+ else
114+ # Trial mode so set the snappy_trial_boot (which snappy is
115+ # expected to unset).
116+ #
117+ # Note: don't use the standard recordfail variable since that forces
118+ # the menu to be displayed and sets an infinite timeout if set.
119+ set snappy_trial_boot=1
120+ save_env snappy_trial_boot
121+ fi
122+fi
123+
124+set label="system-$snappy_ab"
125+set cmdline="root=LABEL=$label ro init=/lib/systemd/systemd console=tty1 console=ttyS0 panic=-1"
126+
127+menuentry "$label" {
128+ if [ -d "$prefix/$snappy_ab" ]; then
129+ linux $prefix/$snappy_ab/vmlinuz $cmdline
130+ initrd $prefix/$snappy_ab/initrd.img
131+ else
132+ # old-style kernel-in-os-partition
133+ search --no-floppy --set --label "$label"
134+ linux /vmlinuz $cmdline
135+ initrd /initrd.img
136+ fi
137+}
138
139=== modified file 'generic-i386/meta/package.yaml'
140--- generic-i386/meta/package.yaml 2015-06-04 12:57:49 +0000
141+++ generic-i386/meta/package.yaml 2015-06-30 11:19:14 +0000
142@@ -1,7 +1,7 @@
143 name: generic-i386
144 vendor: Sergio Schvezov <sergio.schvezov@canonical.com>
145 icon: meta/ubuntu.png
146-version: 1.1
147+version: 1.2
148 type: oem
149
150 config:
151@@ -17,3 +17,6 @@
152 bootloader: grub
153 architecture: i386
154 partition-layout: system-AB
155+ boot-assets:
156+ files:
157+ - path: grub.cfg

Subscribers

People subscribed via source and target branches