Revision c40fd6ae example/hooks/grub
b/example/hooks/grub | ||
---|---|---|
91 | 91 |
if [ "${IMAGE_TYPE}" != "qemu" ] && \ |
92 | 92 |
[ -z "${INSTANCE_HV_kernel_path}" -o "${IMPORT_SCRIPT}" = "1" ] ; then |
93 | 93 |
setup_disk_devs |
94 |
add_devicemap |
|
94 | 95 |
|
95 | 96 |
if [ -e "${boot_dir}/menu.lst" ] ; then |
96 |
add_devicemap |
|
97 | 97 |
# install grub to the block device |
98 | 98 |
chroot ${TARGET} grub --batch --no-floppy \ |
99 | 99 |
--device-map=/boot/grub/device.map <<EOF |
... | ... | |
107 | 107 |
sed --follow-symlinks -ie "s/\(root=UUID=\)\([a-z0-9-]*\)/\1${root_uuid}/g" \ |
108 | 108 |
${boot_dir}/menu.lst |
109 | 109 |
fi |
110 |
# additional kernel arguments for the instance |
|
111 |
if [ -n "${KERNEL_ARGS}" ] ; then |
|
112 |
sed --follow-symlinks -ie "s/\(.*kernel.*\)/\1 ${KERNEL_ARGS}/g" \ |
|
113 |
${boot_dir}/menu.lst |
|
114 |
fi |
|
110 | 115 |
elif [ -e "${boot_dir}/grub.cfg" -a -e "${TARGET}/etc/default/grub" ] ; then |
111 | 116 |
echo "grub2 support is partially supported" |
112 | 117 |
echo "please run update-grub after the instance is online" |
... | ... | |
116 | 121 |
sed --follow-symlinks -ie "s/\(root=UUID=\)\([a-z0-9-]*\)/\1${root_uuid}/g" \ |
117 | 122 |
${boot_dir}/grub.cfg |
118 | 123 |
fi |
124 |
# additional kernel arguments for the instance |
|
125 |
if [ -n "${KERNEL_ARGS}" ] ; then |
|
126 |
sed -ie "s/.*GRUB_CMDLINE_LINUX=\"\(.*\)\"/GRUB_CMDLINE_LINUX=\"\1 ${KERNEL_ARGS}\"/" \ |
|
127 |
${TARGET}/etc/default/grub |
|
128 |
fi |
|
129 |
# show the menu countdown in case we want to boot to a different kernel |
|
130 |
sed -ie 's/.*GRUB_HIDDEN_TIMEOUT=.*/GRUB_HIDDEN_TIMEOUT=5/' ${TARGET}/etc/default/grub |
|
131 |
sed -ie 's/.*GRUB_HIDDEN_TIMEOUT_QUIET=.*/GRUB_HIDDEN_TIMEOUT_QUIET=false/' ${TARGET}/etc/default/grub |
|
119 | 132 |
# install grub2 MBR |
120 | 133 |
chroot ${TARGET} grub-setup --force --device-map=/boot/grub/device.map \ |
121 | 134 |
--directory=/boot/grub --root-device="(hd0,1)" "(hd0)" |
... | ... | |
137 | 150 |
# grub 2.x |
138 | 151 |
add_devicemap |
139 | 152 |
sed -ie 's/.*GRUB_TERMINAL.*/GRUB_TERMINAL=serial/' ${TARGET}/etc/default/grub |
140 |
sed -ie 's/.*GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\"console=ttyS0,115200n8\"/' \
|
|
153 |
sed -ie 's/.*GRUB_CMDLINE_LINUX=\"\(.*\)\"/GRUB_CMDLINE_LINUX=\"\1 console=ttyS0,115200n8\"/' \
|
|
141 | 154 |
${TARGET}/etc/default/grub |
142 | 155 |
echo "GRUB_SERIAL_COMMAND=\"serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1\"" \ |
143 | 156 |
>> ${TARGET}/etc/default/grub |
144 |
chroot ${TARGET} update-grub |
|
145 | 157 |
else |
146 | 158 |
echo "No grub bootloader found, skipping..." |
147 | 159 |
fi |
Also available in: Unified diff