diff options
author | jkh <jkh@FreeBSD.org> | 1999-02-14 05:52:57 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1999-02-14 05:52:57 +0000 |
commit | 8869bfb01e68e9825d37394a8392bf6b073767c0 (patch) | |
tree | 0495a02cfc7a2e38fd60762dff2f6adc1f560655 | |
parent | 377beeaccbbdba8af026477dfb39b3a35aa39d2c (diff) | |
download | FreeBSD-src-8869bfb01e68e9825d37394a8392bf6b073767c0.zip FreeBSD-src-8869bfb01e68e9825d37394a8392bf6b073767c0.tar.gz |
Preserve existing rc.conf contents.
-rw-r--r-- | release/sysinstall/config.c | 12 | ||||
-rw-r--r-- | usr.sbin/sade/config.c | 12 | ||||
-rw-r--r-- | usr.sbin/sysinstall/config.c | 12 |
3 files changed, 24 insertions, 12 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c index cf92b12..8028bef 100644 --- a/release/sysinstall/config.c +++ b/release/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.120 1999/02/05 22:15:47 jkh Exp $ + * $Id: config.c,v 1.121 1999/02/09 22:18:08 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -377,12 +377,16 @@ configRC_conf(void) { FILE *rcSite; Variable *v; + int write_header; - rcSite = fopen("/etc/rc.conf", "w"); + write_header = !file_readable("/etc/rc.conf"); + rcSite = fopen("/etc/rc.conf", "a"); if (!rcSite) return; - fprintf(rcSite, "# This file now contains just the overrides from /etc/defaults/rc.conf\n"); - fprintf(rcSite, "# please make all changes to this file.\n\n"); + if (write_header) { + fprintf(rcSite, "# This file now contains just the overrides from /etc/defaults/rc.conf\n"); + fprintf(rcSite, "# please make all changes to this file.\n\n"); + } /* Now do variable substitutions */ for (v = VarHead; v; v = v->next) { diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index cf92b12..8028bef 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.120 1999/02/05 22:15:47 jkh Exp $ + * $Id: config.c,v 1.121 1999/02/09 22:18:08 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -377,12 +377,16 @@ configRC_conf(void) { FILE *rcSite; Variable *v; + int write_header; - rcSite = fopen("/etc/rc.conf", "w"); + write_header = !file_readable("/etc/rc.conf"); + rcSite = fopen("/etc/rc.conf", "a"); if (!rcSite) return; - fprintf(rcSite, "# This file now contains just the overrides from /etc/defaults/rc.conf\n"); - fprintf(rcSite, "# please make all changes to this file.\n\n"); + if (write_header) { + fprintf(rcSite, "# This file now contains just the overrides from /etc/defaults/rc.conf\n"); + fprintf(rcSite, "# please make all changes to this file.\n\n"); + } /* Now do variable substitutions */ for (v = VarHead; v; v = v->next) { diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index cf92b12..8028bef 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.120 1999/02/05 22:15:47 jkh Exp $ + * $Id: config.c,v 1.121 1999/02/09 22:18:08 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -377,12 +377,16 @@ configRC_conf(void) { FILE *rcSite; Variable *v; + int write_header; - rcSite = fopen("/etc/rc.conf", "w"); + write_header = !file_readable("/etc/rc.conf"); + rcSite = fopen("/etc/rc.conf", "a"); if (!rcSite) return; - fprintf(rcSite, "# This file now contains just the overrides from /etc/defaults/rc.conf\n"); - fprintf(rcSite, "# please make all changes to this file.\n\n"); + if (write_header) { + fprintf(rcSite, "# This file now contains just the overrides from /etc/defaults/rc.conf\n"); + fprintf(rcSite, "# please make all changes to this file.\n\n"); + } /* Now do variable substitutions */ for (v = VarHead; v; v = v->next) { |