Revision c838e846
b/example/hooks/grub | ||
---|---|---|
61 | 61 |
mknod ${TARGET}/dev/${disk}${boot_part} b $(stat -L -c "0x%t 0x%T" $BOOT_DEV) |
62 | 62 |
CLEANUP+=("rm -f ${TARGET}/dev/${disk}${boot_part}") |
63 | 63 |
fi |
64 |
|
|
65 |
# setup minimal proc environment for grub2 |
|
66 |
$MKDIR_P ${TARGET}/proc/ |
|
67 |
cat > ${TARGET}/proc/mounts <<EOF |
|
68 |
/dev/${disk}${boot_part} /boot ${FILESYSTEM} rw,relatime,barrier=1,data=ordered 0 0 |
|
69 |
/dev/${disk}${root_part} / ${FILESYSTEM} rw,relatime,barrier=1,data=ordered 0 0 |
|
70 |
EOF |
|
71 |
CLEANUP+=("rm -r ${TARGET}/proc/mounts") |
|
72 |
|
|
73 |
cat > ${TARGET}/proc/devices <<EOF |
|
74 |
Block devices: |
|
75 |
251 virtblk |
|
76 |
252 device-mapper |
|
77 |
EOF |
|
78 |
CLEANUP+=("rm -r ${TARGET}/proc/devices") |
|
79 |
cat > ${TARGET}/proc/misc << EOF |
|
80 |
60 device-mapper |
|
81 |
EOF |
|
82 |
CLEANUP+=("rm -r ${TARGET}/proc/misc") |
|
64 | 83 |
} |
65 | 84 |
|
66 | 85 |
add_devicemap() { |
... | ... | |
89 | 108 |
${boot_dir}/menu.lst |
90 | 109 |
fi |
91 | 110 |
elif [ -e "${boot_dir}/grub.cfg" -a -e "${TARGET}/etc/default/grub" ] ; then |
92 |
echo "No support for grub 2 currently"
|
|
93 |
#chroot ${TARGET} grub2-install /dev/${disk}
|
|
111 |
echo "grub2 support is partially supported"
|
|
112 |
echo "please run update-grub after the instance is online"
|
|
94 | 113 |
# check to see if grub is using UUID's and replace if so |
95 |
#if [ -n "$(grep 'root=UUID' ${boot_dir}/grub.cfg)" ] ; then |
|
96 |
# root_uuid="$($VOL_ID $ROOT_DEV)" |
|
97 |
# sed --follow-symlinks -ie "s/\(root=UUID=\)\([a-z0-9-]*\)/\1${root_uuid}/g" \ |
|
98 |
# ${boot_dir}/grub.cfg |
|
99 |
#fi |
|
114 |
if [ -n "$(grep 'root=UUID' ${boot_dir}/grub.cfg)" ] ; then |
|
115 |
root_uuid="$($VOL_ID $ROOT_DEV)" |
|
116 |
sed --follow-symlinks -ie "s/\(root=UUID=\)\([a-z0-9-]*\)/\1${root_uuid}/g" \ |
|
117 |
${boot_dir}/grub.cfg |
|
118 |
fi |
|
119 |
# install grub2 MBR |
|
120 |
chroot ${TARGET} grub-setup --force --device-map=/boot/grub/device.map \ |
|
121 |
--directory=/boot/grub --root-device="(hd0,1)" "(hd0)" |
|
100 | 122 |
fi |
101 | 123 |
fi |
102 | 124 |
|
Also available in: Unified diff