Commit graph

441 commits

Author SHA1 Message Date
Renato Botelho 55d2990548 bsdinstall: Fix wifi network selection size
Use correct variable while creating dialog used to select among
available wireless networks

Approved by:	asiciliano
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D45271
2024-05-20 13:39:29 -03:00
Fernando Apesteguía 47535ba3d3 bsdinstall: Remove unused variables in fetchmissingdists
ALL_DISTRIBUTIONS and VERIFY_MANIFEST_SIG

They are neither used in the script nor exported.
Not referenced anywhere in bsdinstall/*

Approved by:		imp@
Differential Revision:	https://reviews.freebsd.org/D42369
2024-05-12 19:25:06 +02:00
Mark Johnston ffbaa453c1 bsdinstall: Stop loading cryptodev for ZFS installations
- zfs depends on the crypto module, not cryptodev, and most arm64 kernel
  configs include std.dev, which includes "device crypto" anyway.
- This config works around a problem with kldxref lacking cross-target
  support, but that has since been fixed.
- Loading cryptodev creates /dev/crypto, which gives unprivileged users
  access to the kernel's opencrypto framework.  Very few applications
  need it, so we're needlessly increasing the kernel's surface area.

Thus, stop auto-loading cryptodev.

Reviewed by:	kevans, allanjude, des
Differential Revision:	https://reviews.freebsd.org/D45127
2024-05-08 12:01:52 -04:00
Bjoern A. Zeeb ad31d47642 bsdinstall: update comment related to pkg
pkg_add has been gone since 2013(?).  Refer to pkg(8) instead.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	jrtc27
Differential Revision: https://reviews.freebsd.org/D44946
2024-04-25 17:44:18 +00:00
Mike Karels 970ea0b2cb bsdinstall: draw attention to new network config options
The network configuration options have changed in bsdinstall, with
an Auto option to proceed directly to DHCP and IPv6 autoconfig (which
is the default) as well as Manual (the old mode).  For users like me
that were used to hitting return automatically to select an interface,
but want manual configuration, attempt to call out the difference:
Change the menu caption to say "Please select a network interface
and configuration mode:" and not just an interface.

Reviewed by:	jrtc27
2024-03-27 15:20:26 -05:00
Philip Paeps 2911c44baf bsdinstall: remove two dead mirrors 2024-02-15 21:49:33 +08:00
Philip Paeps 9c59988175 bsdinstall: prefer HTTP
In 2024, users are more likely to have working HTTP than working FTP.
Present http://ftp.FreeBSD.org as the first option in the installer.
Keep ftp://ftp.FreeBSD.org as the second option.

MFC after:	3 weeks
2024-02-15 21:49:33 +08:00
Jessica Clarke c994f226bb bsdinstall: Add new Auto option to netconfig interface selection dialog
This changes the OK / Cancel buttons into Auto / Manual / Cancel, with
Auto being the default. Manual behaves like OK used to, i.e. presents a
series of dialogs asking exactly how to configure the interface, and
Cancel is unchanged, exiting with exit code 1. Auto will attempt to
configure IPv4+DHCP and IPv6+SLAAC with no interaction, failing only if
neither can be configured, thereby supporting all of IPv4-only,
IPv6-only and dual-stack environments. If at least one DNS server is
provided, it will also skip asking for DNS settings, otherwise it will
act like Manual mode for the purposes of DNS settings and prompt. For a
standard dual-stack environment this cuts down the number of netconfig
dialogs from 6 (interface, IPv4, DHCP, IPv6, SLAAC, DNS) to just the
first one.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D43731
2024-02-09 18:13:47 +00:00
Jessica Clarke 1e75e61d5c bsdinstall: Fix broken netconfig persistence for installed system
The replacement of echo >> with sysrc -f used sysrc key value, which
means "read variables key and value" and thus did nothing useful (and in
fact emitted errors to the log about neither existing). Instead use the
correct sysrc key=value form so the installed system comes back up with
working networking.

Fixes:	60b37735f3 ("bsdinstall netconfig: avoid duplicate entries in rc.conf")
2024-02-03 22:50:47 +00:00
Jessica Clarke 7414d14bd5 bsdinstall: Drop Error from title in netconfig no interfaces dialog
This isn't inherently an error. It is if you're attempting to download
dist tarballs or later install packages, but a FreeBSD system with no
NIC is a reasonable setup to have, especially in a throwaway VM setting,
so we shouldn't say it is one.

Leaving the exit code as 1 is still fine, since auto will ignore it, and
avoids breaking other uses.

MFC after:	1 week
2024-02-03 01:52:53 +00:00
Jessica Clarke b809c7d6a2 bsdinstall: Fix netconfig script when no interfaces are present
The script uses [ -z "$INTERFACES" ] to check if the list of interfaces
is empty and will exit early if so, but INTERFACES always contains at
least a space due to the way it appends the list of wireless devices.
Fix this by only adding the space when there are devices to append,
mirroring the behaviour for non-wireless devices above (both will result
in a redundant leading space when the list is non-empty, but that one is
harmless).

Fixes:		159ca5c844 ("Adapt to new wireless scheme where base wlan interfaces do not show up in ifconfig anymore.")
MFC after:	1 week
2024-02-03 01:52:37 +00:00
Jessica Clarke 7143521f4c Revert "bsdinstall: separate out dist selection in prep for pkgbase support"
Firstly, my review comments were not addressed and instead totally
ignored. Secondly, and a more valid justification for the revert, this
completely breaks the installer, since selectdists isn't installed.
Given the blatant lack of testing, back out this commit until it has
actually been tested and review comments taken on board so that the
installer actually works.

This reverts commit 009d3f66cb.
2024-02-03 01:31:11 +00:00
Brad Davis 009d3f66cb bsdinstall: separate out dist selection in prep for pkgbase support
No functional change intended.

Approved by:	asiciliano
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43621
2024-01-31 15:05:27 -07:00
Michael Gmelin 731704f5ea bsdinstall: Fix installation script splitting
This allows writing setup scripts that contain lines starting with
"#!", e.g., a shebang when creating a shell script using cat:

    #!/bin/sh
    echo "Populate rc.local"
    cat >/etc/rc.local<<EOF
    #!/bin/sh
    echo booted | logger -s -t 'example'
    EOF

Prevent accidentally running a setup script left behind by a
previous invocation of bsdinstall.

Reviewed by:	imp, jrtc27
Differential Revision:	https://reviews.freebsd.org/D43350
2024-01-09 19:14:17 +01:00
Jessica Clarke 47d669f10e bsdinstall: Encode dists to valid variable names in checksum script
Currently we just strip the .txz of the dist name (and add a status_
prefix) to get the shell variable name for its status, but this doesn't
give a valid result for dists like base-dbg, kernel-dbg and lib32-dbg,
or even kernel.KERNCONF (or, combining the two, kernel.KERNCONF-dbg). As
a result, four things go wrong for such dists:

1. If there is a dot and/or a dash in the name, writing to the variable
   fails and spits an error out on stderr to the log
3. If there is a dot in the name before any dash, the syntax is always
   invalid, reading the variable fails, spits an error out on stderr to
   the log, the result is the empty string and that is interpreted as
   being 0%
2. If there is a dash in the name before any dot, and there is a dist
   whose name is the substring up to that first dash, and it has already
   had its status written to, reading the variable instead reads that
   dist's variable and so the status of that dist is displayed instead
3. If there is a dash in the name before any dot, and either there is
   not a dist whose name is the substring up to that first dash or there
   is such a dist but it has not already had its status written to,
   reading the varaible instead results in the substring after the first
   dash, including any additional string expansion syntax that follows
   (i.e. ${status_kernel-dbg:--11}, the expression used to read the
   variable, is interpreted as reading status_kernel with a default
   value of "dbg:--11")

For example, in a default install with base, kernel, kernel-dbg and
lib32, the following sequence of displays happens:

1. base is In Progress, kernel is Pending, kernel-dbg is 0% (what shows
   for the garbage input "dbg:--11") and lib32 is Pending
2. base is Passed, kernel is In Progress, kernel-dbg is In Progress
   (since kernel has now had its status written to) and lib32 is
   Pending
3. base is Passed, kernel is Passed, kernel-dbg is Passed (again, since
   that is the status of kernel, despite that kernel-dbg is being
   verified at this point) and lib32 is Pending
4. base is Passed, kernel is Passed, kernel-dbg is Passed and lib32 is
   In Progress

Fix this with a crude encoding scheme. More special characters can
easily be added if needed in future.

Note that, prior to bsddialog being used (and thus for branches this is
MFC'ed to where dialog is still used), the same problem existed but
displayed slightly differently due to a combination of different default
values and different behaviour for unintended inputs.

Fixes:		b70047d413 ("Add generation of an installation manifest containing SHA256 checksums as ...")
MFC after:	1 week
2023-12-06 21:37:32 +00:00
John Baldwin de82aed119 bsdinstall zfsboot: Don't override ZFSBOOT_FORCE_4K_SECTORS if it is null.
Only set a default value of 1 if the shell variable is unset.  This allows
installer scripts to disable the variable.

PR:		274513
Reported by:	Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>
Differential Revision:	https://reviews.freebsd.org/D42319
2023-11-18 11:18:29 -08:00
Alfonso S. Siciliano e44751530e
bsdinstall hostname: Restore bsdconfig API
Restore bsdconfig API to handle hostname dialog because bsddialog 1.0
matches all features required by bsdconfig(1). Implicitly this commit
restores also Xdialog(1) for this script.

This commit reverts:
 - "bsdinstall hostname: Replace dialog with bsddialog"
   6368dcb292
 - "bsdinstall(8) hostname: Update for bsddialog 0.3"
   5f3ec44e7e.

The script continues to use bsddialog(1) by default via $DIALOG in
bsdconfig(1).
2023-10-19 12:59:49 +02:00
Fernando Apesteguía b9cf989234 bsdinstall: Fail nicely in jail target
If the directory is empty we fail with a message regarding mkdir in which
the empty directory can't be seen because it is not quoted.

Show a nice message so the user knows what is going on.

Reviewed by:		bapt@
Differential Revision:	https://reviews.freebsd.org/D42252
2023-10-18 09:46:05 +02:00
Pierre Pronchery 60b37735f3 bsdinstall netconfig: avoid duplicate entries in rc.conf
This uses sysrc to write and update configuration variables in the
temporary configuration file for network access, ._rc.conf.net. This
replaces the previous mechanism, which was simply appending new values
as they were updated.

PR:		212396
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42194
2023-10-13 12:45:54 -04:00
Pierre Pronchery 01ab86f7e6 bsdinstall: reset the mirror when restarting
It is possible to restart the installation process upon errors, when
installing normally through the `auto` script, or when setting up a jail
with the `jail` script. However, some values obtained interactively from
the user or guessed by some scripts are kept in the environment when
restarting the process; this makes it impossible to run some steps as
expected after the restart.

For instance, if a bad choice of mirror was made in the `mirrorselect`
phase, restarting the installer remembers the choice made, and will
never prompt for a different one. Rebooting is then the only easy way
out of this situation.

This change only affects the `jail` script for now, as otherwise there
is no way to tell if the value had been specifically set by the user
before starting bsdinstall.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42183
2023-10-13 12:32:38 -04:00
Pierre Pronchery ac78e3e9c5 bsdinstall: Add "Finish" button to finalconfig
This adds a "Finish" button to the finalconfig step, replacing the
previous first choice, which was to "apply configuration and exit".
The new button is the default action, while the "OK" button is renamed
to "Select".

Also, if an unknown option is chosen, the code flow prompts the user
again instead of exiting.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42047
2023-10-13 12:23:01 -04:00
Pierre Pronchery a6d202077d bsdinstall: revisit the finalconfig step
This moves the "finalconfig" step into a dedicated script, where it uses
a loop instead of recursing into itself.

Reviewed by:	bapt
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42046
2023-10-13 12:19:39 -04:00
Alfonso S. Siciliano 04b465777a
bsdinstall auto: replace dialog with bsddialog
bsdinstall/scripts/auto: Replace dialog(1) with bsddialog(1).
2023-10-11 18:33:25 +02:00
Alfonso S. Siciliano 160ccec84c
bsdinstall: restore --calendar
Restore --calendar to select a date because bsddialog(1) >= 0.4
provides a calendar dialog.
2023-10-11 15:48:53 +02:00
Alfonso S. Siciliano 8df9efe877
bsdinstall: Fix command line argument list parsing
bsddialog(1) uses getopt_long(3) to parse command line argument list.
Add '--' to avoid errors caused by arguments (menu items) begin
with '-'.
The change is compatible with dialog(1) and Xdialog(1).
2023-10-11 10:17:04 +02:00
Lars Kellogg-Stedman c0e249d32c
bsdinstall: avoid conflicts with fd 3
Throughout the bsdinstall script fd 3 is used by f_dprintf (set through
$TERMINAL_STDOUT_PASSTHRU). In several places in the bsdinstalls scripts,
we use fd 3 to juggle stdout when calling out to other tools, which can
cause the installer to fail with a "Bad file descriptor" error when
f_dprintf attempts to use it.

This commit replaces all constructs like this:

    exec 3>&1
    SOME_VARIABLE=$(some command 2>&1 1>&3)
    exec 3>&-

With:

    exec 5>&1
    SOME_VARIABLE=$(some command 2>&1 1>&5)
    exec 5>&-

PR:			273148
Reviewed by:		corvink
Fixes:			1f7746d81f ("bsdinstall: stop messing with file descriptors")
MFC after:		1 week
2023-09-21 08:41:48 +02:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Baptiste Daroussin fe06db1817 bsdinstall: remove sendmail hardening option
sendmail is fully disabled in 14.0 by default

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D40367
2023-06-01 23:00:22 +02:00
Mike Karels 3bb92304b4 bsdinstall on zfs: create dataset for /home rather than /usr/home
Now that pw (hence adduser and the initial install) use /home for
user home directories rather than /usr/home, create a dataset for
/home rather than /usr/home.  Update the man page to match.

Reviewed by:	rgrimes, markj
Differential Revision:	https://reviews.freebsd.org/D40086
2023-05-23 07:18:27 -05:00
Danilo G. Baio 591e291179 bsdconfig, bsdinstall: Refresh mirrors list
The mirrors list is in sync with the Handbook / Mirrors section [1],
which was refreshed a few months ago. Mirrors removed were not
responding or had duplicated addresses (aliases) with another mirror.

1 - https://docs.freebsd.org/en/books/handbook/mirrors/

Reviewed by:	philip (clusteradm)
Approved by:	philip
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D38014
2023-01-16 13:48:06 -03:00
Mateusz Guzik 65308195e8 bsdinstall: s/to small/too small/
Reported by:	Sulev-Madis Silber <ketas@si.pri.ee>
2022-12-22 17:57:08 +00:00
Jessica Clarke bad602850e bsdinstall: Fix local_unbound option default on revisit
The variable used for the checklist's default value needs to correspond
to the rc.conf variable as that's what's being parsed to determine them.
In the case of local_unbound it's missing the _enable suffix and thus
always defaults to off on revisit.

Fixes:	58eb9abb31 ("Add a line to the post-installation configuration dialog to enable the local_unbound service.")
2022-11-29 03:33:47 +00:00
Jessica Clarke 91985bc5ad bsdinstall: Fix issues parsing rc.conf.services on revisit
There are a few issues here, some of which are hiding others. The first
is that we don't use double quotes around the command substitution so
every word in the conf file is treated as a separate argument to eval,
resulting in spaces being used in place of newlines and thus comments in
the file commenting out the rest of the file, not just to the end of
their line. In particular, we insert one comment just before the dumpdev
entry (the final one in the file) and so we never see dumpdev as set,
and thus set a default value of on for the menu.

The second issue is that, for dumpdev, it takes a value of AUTO not YES
when set, but we don't replace this with on when eval'ing, so then end
up giving AUTO to bsddialog which is interpreted the same as off (which
seems to match GPL dialog). Thus handle AUTO like YES otherwise it will
always appear as unchecked on revisit.

The final issue is that our case-insensitive YES/NO (and now AUTO)
replacements have no word boundaries around them so match the middle of
words too. As it happens this doesn't matter in practice at the moment,
but it could in future; currently the only effect is that it rewrites
moused_nondefault_enable to moused_offndefault_enable, but since this
variable is never read, only written based on moused(_enable) this is
harmless, but we should fix it in case a service comes along in future
that does get affected by it.
2022-11-29 03:33:47 +00:00
Jessica Clarke 1843da3edb bsdinstall: Fix ntpd_sync_on_start service option
This installer option is currently totally useless, as it ends up
creating an ntpd_sync_on_start_enable="YES" entry in rc.conf, not an
ntpd_sync_on_start="YES" entry, as is the correct name. This can also be
noticed by revisiting the services menu, which parses the previously
written rc.conf.services file to set variables governing the default
menu entry values so that selecting OK regenerates the same file, as the
menu entry will use the correct variable name and thus think the entry
was not selected last time, defaulting back to off and losing the
setting.

Thus, add a special case in the loop for this option. The only other
entry that doesn't follow the *_enable pattern is dumpdev (even moused
does, it just also sets a second variable), but that also deviates in
terms of being explicitly set either way and using AUTO rather than YES,
hence why ntpd_sync_on_start follows a different pattern here and is
special-cased rather than introducing a whole new variable that governs
behaviour outside the loop.

Fixes:	c153a35bfd ("bsdinstall: replace ntpdate by ntpd_sync_on_start")
2022-11-29 03:33:47 +00:00
Kyle Evans 12b92f3ed8 bsdinstall: use the correct DISTDIR for fetching local distfiles
fetchmissingdists naturally sets BSDINSTALL_DISTDIR to a directory in
the new filesystem that it can write fetched distfiles to.  As a result,
BSDINSTALL_DISTSITE was incorrectly set to the scratch space on /mnt for
the call to distfetch when grabbing local distfiles, and it would
subsequently fail.

Switch to using the copy of BSDINSTALL_DISTDIR that we stashed off
coming into fetchmissingdists; this one is in-fact set to the path where
the local distfiles are stored.

Patch suggested by jrtc27.

Reported and tested by: Daniel O'Connor <darius dons net au>
MFC after:	1 week
2022-10-14 00:22:09 -05:00
Brad Davis 03d66186f6 bsdinstall: add hooks to allow for easier customizing the install
Approved by:	allanjude
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36459
2022-10-03 09:50:42 -06:00
Vinícius Zavam c153a35bfd
bsdinstall: replace ntpdate by ntpd_sync_on_start
* change current NTP services offered by the FreeBSD Installer;
  * no longer offer ntpdate to be enabled and started on boot;
  * start offering the option to make ntpd set the date and time on boot itself.

The motivation for this change comes from the ntpdate(8) manpage:

  Note: The functionality of this program is now available in the ntpd(8)
  program. See the -q command line option in the ntpd(8) page. After a
  suitable period of mourning, the ntpdate utility is to be retired from
  this distribution.

Approved by:		cy (src), dteske (src)
Differential Revision:	https://reviews.freebsd.org/D36206
2022-09-27 09:04:20 +00:00
Brad Davis 2913e785f0 bsdinstall: fix a couple stragglers in whitelabeling the scripts
PR:		265797
Reviewed by:	allanjude, asiciliano
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36235
2022-09-14 11:06:11 -06:00
Jens Schweikhardt b94e192660 Capitalize title like in all other titles. 2022-09-14 13:42:43 +02:00
Alfonso S. Siciliano 5f3ec44e7e
bsdinstall(8) hostname: Update for bsddialog 0.3
* Delete --hline info. bsddialog(1) 0.3 closes an --inputbox pressing
   only Enter (restoring the previous LGPL-dialog behavior).
 * Add dynamic width auto-sizing.
2022-09-03 22:15:12 +02:00
Brad Davis 17f4ded551 bsdinstall: add variables to allow skipping over some phases of the install
Reviewed by:	allanjude, dteske
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35357
2022-08-16 15:11:44 -06:00
Brad Davis 3e1101f29b bsdinstall: allow setting the root password via env variables
Reviewed by:	0mp, allanjude, asiciliano, dteske, pauamma, rpokala, sef
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35588
2022-08-05 09:10:21 -06:00
Brad Davis a320e9dd51 bsdinstall: improve zfsboots ability to handle datasets under a BE
Currently we only set canmount=noauto on the root of the BE, this
change makes it so we set it on all datasets under the BE as well.

Reviewed by:	allanjude
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35422
2022-06-23 09:21:08 -06:00
Alan Somers 6a02539959 bsdinstall: allow an install script to access packages on the DVD
If installing from the DVD, mount its packages in the chroot at
/dist/packages.  That way they'll be accessible to an install script.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	gjb
Differential Revision: https://reviews.freebsd.org/D35330
2022-06-13 13:27:51 -06:00
Marc Fonvieille 45ef6b4b5d bsdinstall/scripts/docsinstall: Add Indonesian Documentation
Add Indonesian Documentation to docinstall menu.

Approved by:	doceng (implicit) re (gjb, implicit)
MFC after:	1 week
2022-06-06 13:44:43 +02:00
Brad Davis 3bcd261265 bsdinstall: allow overriding DISTRIBUTIONS in the normal auto mode
Reviewed by:	dteske
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35355
2022-06-05 19:04:04 -06:00
Alan Somers 77d678b7a4 Fix a memory leak from caf73e5857
Don't shadow an already-local variable with another local declaration.

Reported by:	dteske
MFC after:	13 days
MFC with:	caf73e5857
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D35331
2022-05-28 13:17:37 -06:00
Alan Somers caf73e5857 bsdinstall: fix prepopulating the ZFS disk menu with ZFSBOOT_DISKS
If the ZFSBOOT_DISKS variable is set to one or more disk names, then
those disks should be preselected in the disk menu.  However, the code
wasn't correctly setting the variable, leaving all disks unselected.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	dteske
Differential Revision: https://reviews.freebsd.org/D35331
2022-05-27 09:09:33 -06:00
Alan Somers 7919c76dbd bsdinstall: use gpt/efiboot0 label in /etc/fstab
Otherwise, boot will hang if the numbering of disks has changed since
initial install.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	brd
Differential Revision: https://reviews.freebsd.org/D35309
2022-05-24 13:17:10 -06:00
Brad Davis cc42ef5328 bsdinstall: allow whitelabeling the scripts
Approved by:		allanjude, asiciliano
Differential Revision:	https://reviews.freebsd.org/D35197
Sponsored by:		Rubicon Communications, LLC ("Netgate")
2022-05-24 09:49:06 -06:00