Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/postinstall Add a ptyfsoldnodes item that checks/re...
details: https://anonhg.NetBSD.org/src/rev/0ecd76df89fc
branches: trunk
changeset: 780961:0ecd76df89fc
user: martin <martin%NetBSD.org@localhost>
date: Mon Aug 13 10:20:52 2012 +0000
description:
Add a ptyfsoldnodes item that checks/removes old /dev/{p,t}ty* nodes
if ptyfs is used.
diffstat:
usr.sbin/postinstall/postinstall | 44 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 1 deletions(-)
diffs (60 lines):
diff -r 8bc4d03f66b3 -r 0ecd76df89fc usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall Mon Aug 13 08:39:28 2012 +0000
+++ b/usr.sbin/postinstall/postinstall Mon Aug 13 10:20:52 2012 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: postinstall,v 1.138 2012/06/28 16:34:06 kefren Exp $
+# $NetBSD: postinstall,v 1.139 2012/08/13 10:20:52 martin Exp $
#
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -1750,6 +1750,48 @@
#
+# ptyfsoldnodes
+#
+additem ptyfsoldnodes "remove legacy device nodes when using ptyfs"
+do_ptyfsoldnodes()
+{
+ [ -n "$1" ] || err 3 "USAGE: do_ptyfsoldnodes fix|check"
+
+ # check if ptyfs is in use
+ failed=0;
+ if ${EGREP} "^ptyfs" "${DEST_DIR}/etc/fstab" > /dev/null; then
+ maj_t=$( ${AWK} < "${DEST_DIR}/dev/MAKEDEV" \
+ '/mkdev ttyp0 c [0-9]* 0 666/{print $4}' )
+ maj_p=$( ${AWK} < "${DEST_DIR}/dev/MAKEDEV" \
+ '/mkdev ptyp0 c [0-9]* 0 666/{print $4}' )
+
+ pcnt=$( find "${DEST_DIR}/dev" -xdev -type c -ls | \
+ ${AWK} '{print $7 $12}' | \
+ ${AWK} -F, "/^${maj_p},/{ print \$2}" | wc -l )
+ tcnt=$( find "${DEST_DIR}/dev" -xdev -type c -ls | \
+ ${AWK} '{print $7 $12}' | \
+ ${AWK} -F, "/^${maj_t},/{ print \$2}" | wc -l )
+
+ if [ ${pcnt} -gt 0 -o ${tcnt} -gt 0 ]; then
+ if [ "$1" = "fix" ]; then
+ find "${DEST_DIR}/dev" -xdev -type c -ls | \
+ ${AWK} '{print $7 $12}' | \
+ ${AWK} -F, "/^${maj_p},/{ print \$2}" \
+ | xargs rm
+ find "${DEST_DIR}/dev" -xdev -type c -ls | \
+ ${AWK} '{print $7 $12}' | \
+ ${AWK} -F, "/^${maj_t},/{ print \$2}" \
+ | xargs rm
+ else
+ failed=1
+ fi
+ fi
+ fi
+ return ${failed}
+}
+
+
+#
# end of items
# ------------
#
Home |
Main Index |
Thread Index |
Old Index