From owner-svn-src-all@FreeBSD.ORG Sat Aug 7 12:46:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11144106566B; Sat, 7 Aug 2010 12:46:50 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F368B8FC14; Sat, 7 Aug 2010 12:46:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77CknGw042980; Sat, 7 Aug 2010 12:46:49 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77Ckniq042978; Sat, 7 Aug 2010 12:46:49 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201008071246.o77Ckniq042978@svn.freebsd.org> From: Bruce Cran Date: Sat, 7 Aug 2010 12:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211010 - stable/7/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 12:46:50 -0000 Author: brucec Date: Sat Aug 7 12:46:49 2010 New Revision: 211010 URL: http://svn.freebsd.org/changeset/base/211010 Log: MFC r209467: When installing on a machine which doesn't have a VGA card installed, enable a getty on the serial port so that it's possible to login when the system is rebooted. PR: bin/23098 Submitted by: Doug Ambrisko Approved by: rrs (mentor) Modified: stable/7/usr.sbin/sysinstall/install.c Directory Properties: stable/7/usr.sbin/sysinstall/ (props changed) Modified: stable/7/usr.sbin/sysinstall/install.c ============================================================================== --- stable/7/usr.sbin/sysinstall/install.c Sat Aug 7 12:41:12 2010 (r211009) +++ stable/7/usr.sbin/sysinstall/install.c Sat Aug 7 12:46:49 2010 (r211010) @@ -839,6 +839,9 @@ installConfigure(void) int installFixupBase(dialogMenuItem *self) { + FILE *orig, *new; + char buf[1024]; + char *pos; FILE *fp; #ifdef __ia64__ const char *efi_mntpt; @@ -855,6 +858,32 @@ installFixupBase(dialogMenuItem *self) fclose(fp); } #endif + + /* Fixup /etc/ttys to start a getty on the serial port. + This way after a serial installation you can login via + the serial port */ + + if (!OnVTY){ + if (((orig=fopen("/etc/ttys","r")) != NULL) && + ((new=fopen("/etc/ttys.tmp","w")) != NULL)) { + while (fgets(buf,sizeof(buf),orig)){ + if (strstr(buf,"ttyd0")){ + if ((pos=strstr(buf,"off"))){ + *pos++='o'; + *pos++='n'; + *pos++=' '; + } + } + fputs(buf,new); + } + fclose(orig); + fclose(new); + + rename("/etc/ttys.tmp","/etc/ttys"); + unlink("/etc/ttys.tmp"); + } + } + /* BOGON #2: We leave /etc in a bad state */ chmod("/etc", 0755);