+# update device map if possible
+if [ -f "$device_map" ]; then
+ mv -f "$device_map" "$device_map.old"
+fi
+grub --batch --no-floppy --device-map="$device_map" <<'EOF' >/dev/null 2>&1
+quit
+EOF
+if [ ! -s "$device_map" ]; then
+ if [ -f "$device_map.old" ]; then
+ mv -f "$device_map.old" "$device_map"
+ fi
+
+else
+ rm -f "$device_map.old"
+fi
+echo -n " grub3"
+
+# import GRUB helper functions (again, updated device map)
+. /usr/share/kernel-2.6-cn/grub-functions.sh
+
+# get install device (0x80 BIOS device)
+install_device=$(grep '^(hd0)' "$device_map" | \
+ sed -e 's%[^[:space:]]*[[:space:]]*\([^[:space:]]*\)%\1%')
+if [ -z "$install_device" ]; then