Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/miniroot Handle hostname being set in /mnt/etc/rc.conf



details:   https://anonhg.NetBSD.org/src/rev/c59c9a6bc114
branches:  trunk
changeset: 499559:c59c9a6bc114
user:      abs <abs%NetBSD.org@localhost>
date:      Wed Nov 22 21:04:46 2000 +0000

description:
Handle hostname being set in /mnt/etc/rc.conf

diffstat:

 distrib/miniroot/install.sub |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 0d1604afefbc -r c59c9a6bc114 distrib/miniroot/install.sub
--- a/distrib/miniroot/install.sub      Wed Nov 22 19:20:31 2000 +0000
+++ b/distrib/miniroot/install.sub      Wed Nov 22 21:04:46 2000 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-#      $NetBSD: install.sub,v 1.38 2000/11/14 20:37:25 is Exp $
+#      $NetBSD: install.sub,v 1.39 2000/11/22 21:04:46 abs Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -496,11 +496,18 @@
 enable_network() {
 
        # Set up the hostname.
-       if [ ! -f /mnt/etc/myname ]; then
+       if [ -f /mnt/etc/myname ]; then
+               hostname=`cat /mnt/etc/myname`
+       elif [ -f /mnt/etc/rc.conf ];then
+               hostname=`sh -c '. /mnt/etc/rc.conf ; echo $hostname'`
+       else
                echo "ERROR: no /etc/myname!"
                return 1
        fi
-       hostname=`cat /mnt/etc/myname`
+       if [ -z "$hostname" ];then
+               echo "ERROR: hostname not set in /etc/myname or /etc/rc.conf!"
+               return 1
+       fi
        hostname $hostname
 
        # configure all the interfaces which we know about.



Home | Main Index | Thread Index | Old Index