summaryrefslogtreecommitdiff
path: root/distrib/sun3/common/mr.remount
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-06 21:28:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-06 21:28:54 +0000
commit3a8586df9b4f5aa46488d8ef9d0e4e8580af51e4 (patch)
treef00fac94798549eeaa90ba6355496ea5cf08fd7b /distrib/sun3/common/mr.remount
parentc40deccda1a5145413b1a52c9275d3c3c1406b4d (diff)
from netbsd
Diffstat (limited to 'distrib/sun3/common/mr.remount')
-rw-r--r--distrib/sun3/common/mr.remount34
1 files changed, 34 insertions, 0 deletions
diff --git a/distrib/sun3/common/mr.remount b/distrib/sun3/common/mr.remount
new file mode 100644
index 00000000000..1cb747484da
--- /dev/null
+++ b/distrib/sun3/common/mr.remount
@@ -0,0 +1,34 @@
+#!/bin/sh
+# $NetBSD: mr.remount,v 1.1 1995/11/01 23:53:29 gwr Exp $
+#
+# Find out what the root is mounted on,
+# remount the root read/write, then
+# create a valid /etc/fstab for it.
+#
+# Uses: dmesg, grep, mount
+
+# Given a sequence of lines like: "root on sd0b"
+# print the last part of the last line: "sd0b"
+findroot() {
+ name='??'
+ while read a b c d
+ do
+ name="$c"
+ done
+ echo "$name"
+}
+
+if [ -f /etc/fstab ]
+then
+ echo "root already mounted read/write"
+ exit 1
+fi
+
+echo "Determining current root device..."
+root=`/sbin/dmesg |grep '^root on ' |findroot`
+
+echo "Remounting root device $root"
+/sbin/mount -u "/dev/$root" /
+
+echo "/dev/$root / ufs rw 1 1" > /etc/fstab
+exit 0