diff options
author | brucec <brucec@FreeBSD.org> | 2010-06-23 14:11:34 +0000 |
---|---|---|
committer | brucec <brucec@FreeBSD.org> | 2010-06-23 14:11:34 +0000 |
commit | b2337fe9dd8bd759c1535c5e805731500ca30878 (patch) | |
tree | 549f7359bcab5e975d553fa2e2791ab130c42b5a /usr.sbin/sysinstall | |
parent | 2336901ce82ac057c24f7e993adfc40e6d127ddf (diff) | |
download | FreeBSD-src-b2337fe9dd8bd759c1535c5e805731500ca30878.zip FreeBSD-src-b2337fe9dd8bd759c1535c5e805731500ca30878.tar.gz |
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 <ambrisko at whistle.com>
Reviewed by: randi
Approved by: rrs (mentor)
MFC after: 1 month
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r-- | usr.sbin/sysinstall/install.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index e7188fd..4e7de1a 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -877,6 +877,9 @@ installConfigure(void) int installFixupBase(dialogMenuItem *self) { + FILE *orig, *new; + char buf[1024]; + char *pos; #if defined(__i386__) || defined(__amd64__) FILE *fp; #endif @@ -895,6 +898,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,"ttyu0")){ + 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); |