The branch main has been updated by brd:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=147585b4893bc38698aaa971af336b241477eac3

commit 147585b4893bc38698aaa971af336b241477eac3
Author:     Brad Davis <[email protected]>
AuthorDate: 2022-05-13 16:35:43 +0000
Commit:     Brad Davis <[email protected]>
CommitDate: 2022-05-13 16:35:43 +0000

    bsdinstall: allow whitelabeling the installer
    
    Override OSNAME to change the name of the OS in the installer.
    
    This is a first step, the shell changes will be separate.
    
    Reviewed by:            allanjude
    Approved by:            allanjude
    Differential Revision:  https://reviews.freebsd.org/D34878
    Sponsored by:           Rubicon Communications, LLC ("Netgate")
---
 usr.sbin/bsdinstall/Makefile                  | 9 +++++++++
 usr.sbin/bsdinstall/distextract/Makefile      | 2 +-
 usr.sbin/bsdinstall/distextract/distextract.c | 4 +++-
 usr.sbin/bsdinstall/distfetch/Makefile        | 2 +-
 usr.sbin/bsdinstall/distfetch/distfetch.c     | 4 +++-
 usr.sbin/bsdinstall/partedit/Makefile         | 2 +-
 usr.sbin/bsdinstall/partedit/part_wizard.c    | 8 ++++----
 usr.sbin/bsdinstall/partedit/partedit.c       | 8 ++++----
 usr.sbin/bsdinstall/partedit/partedit.h       | 2 ++
 9 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/usr.sbin/bsdinstall/Makefile b/usr.sbin/bsdinstall/Makefile
index 88cb691d8dda..761051a5f48f 100644
--- a/usr.sbin/bsdinstall/Makefile
+++ b/usr.sbin/bsdinstall/Makefile
@@ -1,9 +1,18 @@
 # $FreeBSD$
 
+OSNAME?=       FreeBSD
 SUBDIR= distextract distfetch partedit scripts
 SUBDIR_PARALLEL=
 SCRIPTS= bsdinstall
 MAN= bsdinstall.8
 PACKAGE=       bsdinstall
+GENHDRS=       opt_osname.h
+SRCS+=         ${GENHDRS}
+CLEANFILES+=   ${GENHDRS}
+
+opt_osname.h: .PHONY
+       if ! grep -q "^#define OSNAME \"${OSNAME}\"$"" ${.TARGET}; then \
+               echo "#define OSNAME \"${OSNAME}\"" > ${.TARGET}; \
+       fi
 
 .include <bsd.prog.mk>
diff --git a/usr.sbin/bsdinstall/distextract/Makefile 
b/usr.sbin/bsdinstall/distextract/Makefile
index 5e9f2b9e1473..6ae9bb65e8fb 100644
--- a/usr.sbin/bsdinstall/distextract/Makefile
+++ b/usr.sbin/bsdinstall/distextract/Makefile
@@ -2,7 +2,7 @@
 
 BINDIR= ${LIBEXECDIR}/bsdinstall
 PROG=  distextract
-CFLAGS+= -I${SRCTOP}/contrib/bsddialog/lib
+CFLAGS+= -I${SRCTOP}/contrib/bsddialog/lib -I${.OBJDIR}/..
 LIBADD=        archive bsddialog m
 
 MAN=
diff --git a/usr.sbin/bsdinstall/distextract/distextract.c 
b/usr.sbin/bsdinstall/distextract/distextract.c
index f7f973fe336c..30400ba0f021 100644
--- a/usr.sbin/bsdinstall/distextract/distextract.c
+++ b/usr.sbin/bsdinstall/distextract/distextract.c
@@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <unistd.h>
 
+#include "opt_osname.h"
+
 /* Data to process */
 static const char *distdir = NULL;
 static struct archive *archive = NULL;
@@ -82,7 +84,7 @@ main(void)
                errx(EXIT_FAILURE, "Error libbsdialog: %s",
                    bsddialog_geterror());
        bsddialog_initconf(&conf);
-       bsddialog_backtitle(&conf, "FreeBSD Installer");
+       bsddialog_backtitle(&conf, OSNAME " Installer");
        bsddialog_infobox(&conf,
            "Checking distribution archives.\nPlease wait...", 4, 35);
 
diff --git a/usr.sbin/bsdinstall/distfetch/Makefile 
b/usr.sbin/bsdinstall/distfetch/Makefile
index f4ae37edf1a5..0104df0e3aec 100644
--- a/usr.sbin/bsdinstall/distfetch/Makefile
+++ b/usr.sbin/bsdinstall/distfetch/Makefile
@@ -2,7 +2,7 @@
 
 BINDIR= ${LIBEXECDIR}/bsdinstall
 PROG=  distfetch
-CFLAGS+=       -I${SRCTOP}/contrib/bsddialog/lib
+CFLAGS+=       -I${SRCTOP}/contrib/bsddialog/lib -I${.OBJDIR}/..
 LIBADD=        fetch bsddialog
 
 MAN=
diff --git a/usr.sbin/bsdinstall/distfetch/distfetch.c 
b/usr.sbin/bsdinstall/distfetch/distfetch.c
index c5749c07854a..6963ee08968f 100644
--- a/usr.sbin/bsdinstall/distfetch/distfetch.c
+++ b/usr.sbin/bsdinstall/distfetch/distfetch.c
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <unistd.h>
 
+#include "opt_osname.h"
+
 static int fetch_files(int nfiles, char **urls);
 
 int
@@ -76,7 +78,7 @@ main(void)
                    bsddialog_geterror());
        }
        bsddialog_initconf(&conf);
-       bsddialog_backtitle(&conf, "FreeBSD Installer");
+       bsddialog_backtitle(&conf, OSNAME " Installer");
 
        for (i = 0; i < ndists; i++) {
                urls[i] = malloc(PATH_MAX);
diff --git a/usr.sbin/bsdinstall/partedit/Makefile 
b/usr.sbin/bsdinstall/partedit/Makefile
index f89a1d374fb8..96c4ddb53961 100644
--- a/usr.sbin/bsdinstall/partedit/Makefile
+++ b/usr.sbin/bsdinstall/partedit/Makefile
@@ -5,7 +5,7 @@ PROG=   partedit
 LINKS= ${BINDIR}/partedit ${BINDIR}/autopart \
        ${BINDIR}/partedit ${BINDIR}/scriptedpart
 SYMLINKS= ../libexec/bsdinstall/partedit /usr/sbin/sade
-CFLAGS+=       -I${SRCTOP}/contrib/bsddialog/lib
+CFLAGS+=       -I${SRCTOP}/contrib/bsddialog/lib -I${.OBJDIR}/..
 LIBADD+=       geom util bsddialog
 
 PARTEDIT_ARCH= ${MACHINE}
diff --git a/usr.sbin/bsdinstall/partedit/part_wizard.c 
b/usr.sbin/bsdinstall/partedit/part_wizard.c
index a030608ac764..83fc29eb0359 100644
--- a/usr.sbin/bsdinstall/partedit/part_wizard.c
+++ b/usr.sbin/bsdinstall/partedit/part_wizard.c
@@ -173,7 +173,7 @@ boot_disk_select(struct gmesh *mesh)
        if (n > 1) {
                conf.title = "Partitioning";
                button = bsddialog_menu(&conf,
-                   "Select the disk on which to install FreeBSD.", 0, 0, 0,
+                   "Select the disk on which to install " OSNAME ".", 0, 0, 0,
                    n, disks, &selected);
 
                chosen = (button == BSDDIALOG_OK) ?
@@ -259,7 +259,7 @@ query:
                conf.button.default_cancel = true;
 
        snprintf(message, sizeof(message), "Would you like to use this entire "
-           "disk (%s) for FreeBSD or partition it to share it with other "
+           "disk (%s) for " OSNAME " or partition it to share it with other "
            "operating systems? Using the entire disk will erase any data "
            "currently stored there.", disk);
        conf.title = "Partition";
@@ -275,7 +275,7 @@ query:
 
                sprintf(warning, "The existing partition scheme on this "
                    "disk (%s) is not bootable on this platform. To install "
-                   "FreeBSD, it must be repartitioned. This will destroy all "
+                   OSNAME ", it must be repartitioned. This will destroy all "
                    "data on the disk. Are you sure you want to proceed?",
                    scheme);
                conf.title = "Non-bootable Disk";
@@ -362,7 +362,7 @@ wizard_makeparts(struct gmesh *mesh, const char *disk, 
const char *fstype,
                humanize_number(neededstr, 7, MIN_FREE_SPACE, "B", HN_AUTOSCALE,
                    HN_DECIMAL);
                sprintf(message, "There is not enough free space on %s to "
-                   "install FreeBSD (%s free, %s required). Would you like "
+                   "install " OSNAME " (%s free, %s required). Would you like "
                    "to choose another disk or to open the partition editor?",
                    disk, availablestr, neededstr);
 
diff --git a/usr.sbin/bsdinstall/partedit/partedit.c 
b/usr.sbin/bsdinstall/partedit/partedit.c
index bcf107f7b397..22d1dbfca194 100644
--- a/usr.sbin/bsdinstall/partedit/partedit.c
+++ b/usr.sbin/bsdinstall/partedit/partedit.c
@@ -95,7 +95,7 @@ main(int argc, const char **argv)
                err(1, "%s", bsddialog_geterror());
        bsddialog_initconf(&conf);
        if (!sade_mode)
-               bsddialog_backtitle(&conf, "FreeBSD Installer");
+               bsddialog_backtitle(&conf, OSNAME " Installer");
        i = 0;
 
        /* Revert changes on SIGINT */
@@ -118,7 +118,7 @@ main(int argc, const char **argv)
                        return (error);
                }
        } else {
-               prompt = "Create partitions for FreeBSD, F1 for help.\n"
+               prompt = "Create partitions for " OSNAME ", F1 for help.\n"
                    "No changes will be made until you select Finish.";
        }
 
@@ -294,7 +294,7 @@ validate_setup(void)
        if (root == NULL) {
                conf.title = "Error";
                bsddialog_msgbox(&conf, "No root partition was found. "
-                   "The root FreeBSD partition must have a mountpoint "
+                   "The root " OSNAME " partition must have a mountpoint "
                    "of '/'.", 0, 0);
                return (false);
        }
@@ -308,7 +308,7 @@ validate_setup(void)
                conf.title = "Warning";
                button = bsddialog_yesno(&conf, "The chosen root partition "
                    "has a preexisting filesystem. If it contains an existing "
-                   "FreeBSD system, please update it with freebsd-update "
+                   OSNAME " system, please update it with freebsd-update "
                    "instead of installing a new system on it. The partition "
                    "can also be erased by pressing \"No\" and then deleting "
                    "and recreating it. Are you sure you want to proceed?",
diff --git a/usr.sbin/bsdinstall/partedit/partedit.h 
b/usr.sbin/bsdinstall/partedit/partedit.h
index 5c0405922d21..aa1ec285ff80 100644
--- a/usr.sbin/bsdinstall/partedit/partedit.h
+++ b/usr.sbin/bsdinstall/partedit/partedit.h
@@ -35,6 +35,8 @@
 #include <inttypes.h>
 #include <fstab.h>
 
+#include "opt_osname.h"
+
 struct gprovider;
 struct gmesh;
 struct ggeom;

Reply via email to