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")
This commit is contained in:
Brad Davis 2022-05-13 10:35:43 -06:00
parent 2c4499dcd7
commit 147585b489
9 changed files with 28 additions and 13 deletions

View file

@ -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>

View file

@ -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=

View file

@ -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);

View file

@ -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=

View file

@ -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);

View file

@ -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}

View file

@ -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 @@ wizard_partition(struct gmesh *mesh, const char *disk)
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 @@ wizard_partition(struct gmesh *mesh, const char *disk)
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);

View file

@ -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?",

View file

@ -35,6 +35,8 @@
#include <inttypes.h>
#include <fstab.h>
#include "opt_osname.h"
struct gprovider;
struct gmesh;
struct ggeom;