-# $OpenBSD: dot.profile,v 1.7 2007/11/16 21:18:35 krw Exp $
+# $OpenBSD: dot.profile,v 1.8 2008/08/03 14:18:00 krw Exp $
# $NetBSD: dot.profile,v 1.1 1995/12/18 22:54:43 pk Exp $
#
# Copyright (c) 1995 Jason R. Thorpe
# emacs-style command line editing
set -o emacs
-rootdisk=`dmesg|sed -n '/^root on /!d;${s#^root on \([^ ]*\).*#/dev/\1#;p;}'`
+# Extract rootdisk from last 'root on wd0a swap on wd0b dump on wd0b' line.
+set -- `dmesg | sed -n '/^root on /h;${g;p;}'`
+rootdisk=$3
if [ "X${DONEPROFILE}" = "X" ]; then
DONEPROFILE=YES
- mount -u ${rootdisk:-/dev/rd0a} /
+ mount -u /dev/${rootdisk:-rd0a} /
# set up some sane defaults
echo 'erase ^?, werase ^W, kill ^U, intr ^C, status ^T'