Commit Graph

596 Commits

Author SHA1 Message Date
Renato Botelho
371ce0ebc2 bsdinstall: Make sure chroot filesystems are umounted after use
* DISTDIR_IS_UNIONFS is set every time BSDINSTALL_DISTDIR is mounted inside
  BSDINSTALL_CHROOT. Use this flag to decide if it needs to be umounted
* BSDINSTALL_CHROOT/dev is mounted when 'bsdinstall mount' is called, there is
  no need to mount it again when user goes to shell after installation

Reviewed by:	allanjude
Obtained from:	pfSense
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D8573
2017-02-08 17:03:52 +00:00
Ravi Pokala
0ee82391df Fix indentation (only line in file w/ 8-space indent rather than hard-tab).
MFH:		1 week
2017-02-08 00:02:54 +00:00
Yoshihiro Takahashi
2b375b4edd Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes:	yes
2017-01-28 02:22:15 +00:00
Devin Teske
a7cc56803c Revert r309918 -- modern POSIX has deprecated -<#>/+<#> syntax
Special thanks to:	jilles
2016-12-13 22:31:49 +00:00
Devin Teske
f3a8471e5f It's completely pointless to replace newlines with space
(this is done automatically for you upon shell expansion)
2016-12-13 02:56:52 +00:00
Devin Teske
be094a3204 The flags of a WLAN need to be quoted (they contain things like brackets) 2016-12-13 02:54:44 +00:00
Devin Teske
19dbb0ba18 Simplify single-line if statements 2016-12-13 02:48:14 +00:00
Devin Teske
afcce2f52d Simplify loop by moving predicate to clause 2016-12-13 02:47:39 +00:00
Devin Teske
b46ca7cefe Wordsmithing 2016-12-13 02:46:36 +00:00
Devin Teske
a9d334210f Why test $? when you can test the command 2016-12-13 02:45:52 +00:00
Devin Teske
6ef8ca674f Restore previous comment 2016-12-13 02:45:07 +00:00
Devin Teske
94f5aec600 Both simplify bringup of interface after changes and catch errors in debug 2016-12-13 02:44:33 +00:00
Devin Teske
b9f60aba8b Calculate proper size of menu list dialog 2016-12-13 02:42:10 +00:00
Devin Teske
9a46c67aed There's an API function for catching errors and displaying them or
logging them to debug output
2016-12-13 02:40:54 +00:00
Devin Teske
7e1166de96 There's an API function for displaying pauses 2016-12-13 02:30:24 +00:00
Devin Teske
d79a135578 There's an API function for displaying yes/no dialogs 2016-12-13 02:29:20 +00:00
Devin Teske
1d92999c48 There's an API function for displaying errors 2016-12-13 02:27:38 +00:00
Devin Teske
35af83c188 Comment 2016-12-13 02:25:23 +00:00
Devin Teske
b45548a80e Whitespace alignment 2016-12-13 02:23:48 +00:00
Devin Teske
d5fddc4dcb Relying on dialog auto-sizing (width/height/rows = 0) is a mistake
Use the provided API for calculating the appropriate size of menus
2016-12-13 02:22:21 +00:00
Devin Teske
7599c85424 Remove unnecessary quotes 2016-12-13 02:16:00 +00:00
Devin Teske
1095816ec3 Add missing quotes 2016-12-13 02:15:36 +00:00
Devin Teske
01a2404c35 In awk, if you're going to append a newline to your printf
AND you're going to print only the argument, just use print
2016-12-13 02:14:40 +00:00
Devin Teske
dba958af5d This statement has too many backslashes 2016-12-13 02:13:20 +00:00
Devin Teske
be34885e2a Neither printf (and as is commonly known) nor print need parens in awk 2016-12-13 02:12:00 +00:00
Devin Teske
5943bcd19f Whitespace and alignment 2016-12-13 02:11:09 +00:00
Devin Teske
191441eed8 You don't need parentheses for awk's printf 2016-12-13 02:07:12 +00:00
Devin Teske
0724c87c95 Continued resolution of conveluted statement
We shouldn't be coding things like "x || (x && x) || x || x || x ..."
2016-12-13 02:04:50 +00:00
Devin Teske
32c34b0361 These two error messages have always been backwards since inception 2016-12-13 02:02:14 +00:00
Devin Teske
7f513d3675 Why use $? when you can use the command itself 2016-12-13 01:59:35 +00:00
Devin Teske
6b77f63e5d If the first ping succeeded, why on Earth should we ping it again? 2016-12-13 01:56:28 +00:00
Devin Teske
a1a6fec1c7 Start deconstructing a conveluted hunk of code 2016-12-13 01:54:44 +00:00
Devin Teske
19cae84e23 Remove completely unnecesary parentheses 2016-12-13 01:52:10 +00:00
Devin Teske
751993945a Why repeat yourself when you can send stderr to the same place as stdout? 2016-12-13 01:50:22 +00:00
Devin Teske
66ef7d9455 Properly quote variable 2016-12-13 01:44:18 +00:00
Devin Teske
a51195769a Use more generic f_yesno() from provided API 2016-12-13 01:42:13 +00:00
Devin Teske
f52733d46e The output of dialog needs to be sanitized
for portability/compatibility requirements
2016-12-13 01:41:06 +00:00
Devin Teske
f20b7768fc Whitespace alignment 2016-12-13 01:39:09 +00:00
Devin Teske
d401d36c04 Sort the domains 2016-12-13 01:36:46 +00:00
Devin Teske
95ee591e83 The --no-items and --stdout options are non-standard and should be avoided
From the dialog(1) manual:
using [--stdout] in portable scripts is not recommended
2016-12-13 01:35:26 +00:00
Devin Teske
6e038cc2eb More efficiently make use of the exit status 2016-12-13 00:27:56 +00:00
Devin Teske
1c61211223 Stop repeating strings (centralize prompt string)
NB: Changes to strings now only affect a single line
2016-12-13 00:22:01 +00:00
Devin Teske
e2577019ed Add missing backslash (no real effect; it's pedantic and correct for
the interpolation level)
2016-12-13 00:18:51 +00:00
Devin Teske
e7f2eb12c2 Use the oft-neglected awk syntax "startcondition, stopcondition { ... }" to
process the range of country labels which appear as columnar list from the
"ifconfig DEV list countries" command. Not only improving maintainability,
but also properly encapsulating arguments in single-quotes instead of
trying to escape whitespace. It is also completely unnecessary to collapse
newlines into whitespace (shell will do this for you automatically upon
expansion of the contents where necessary).

NB: This also changes the sorting algorithm to sort on the country code,
not the country name. The type-ahead feature of dialog is destroyed if the
tags are not sorted properly.
2016-12-13 00:02:59 +00:00
Devin Teske
49748e0a6d Quote WLAN_IFACE (pedantic) 2016-12-12 22:57:07 +00:00
Devin Teske
6c26775c2f In awk, casting a variable as a boolean condition is the same as testing if
the length of the variable contents is greater than zero

This allows us to also move the secondary condition into the action clause
2016-12-12 21:29:48 +00:00
Devin Teske
275c0c0741 Remove an unnecessary call to f_dialog_title_restore() 2016-12-12 21:27:29 +00:00
Devin Teske
1045858386 Whitespace 2016-12-12 21:26:36 +00:00
Devin Teske
d124dfc410 Utilize provided i18n strings 2016-12-12 21:23:47 +00:00
Devin Teske
877ea04721 Remove incomplete and unnecessary creation of fd3
The provided API already provides a passthru descriptor and even
gives you a varaible for referring to it.
2016-12-12 21:20:56 +00:00
Devin Teske
8bcf564644 Remove unnecessary semi-colons 2016-12-12 21:18:24 +00:00
Devin Teske
0b8f01fe99 Use awk the following (more succinct) awk syntax:
condition1 { action1 }
	condition2 { action2 }

instead of the following syntax:

	{
		if (condition1) { action1 }
		else if (condition2) { action2 }
	}
2016-12-12 21:16:37 +00:00
Devin Teske
d9f83eb9f4 1 is the default descriptor for redirects without an fd prefix 2016-12-12 21:11:55 +00:00
Devin Teske
bef42d18c5 Fix invalid parameter expansion (change $@ to "$@")
Without quotes, $@ loses its special meanining (see below)

% sh -c 'echo $@' /bin/sh "   1   " "   2   "
1 2
% sh -c 'echo "$@"' /bin/sh "   1   " "   2   "
   1       2

The quotes are required to get ARGV to be unperterped
2016-12-12 21:04:11 +00:00
Devin Teske
35c8d5eb1b Allow the script path to contain whitespace and special characters 2016-12-12 21:01:20 +00:00
Devin Teske
58ce2edc98 Use provided API to centralize dialog title strings 2016-12-12 21:00:09 +00:00
Devin Teske
7797a5973f Reorder dialog parameters based on commonality for readability 2016-12-12 20:54:20 +00:00
Devin Teske
6ea6e3fa7d Fix incorrect use of provided API
The result of which was incorrectly sized menu dialogs
2016-12-12 20:49:49 +00:00
Devin Teske
ea2e60b01c Use provided API (change "dialog" to "$DIALOG") 2016-12-12 20:43:09 +00:00
Devin Teske
2abc4c242e Whitespace (dialog options separated to minimize diffs) 2016-12-12 20:41:27 +00:00
Devin Teske
b5938e7da3 Consolidate redirects into here documents, with proper code indentation 2016-12-12 19:46:49 +00:00
Devin Teske
15fadc4858 Remove an unnecessary "return $?" at end of function 2016-12-12 19:26:55 +00:00
Devin Teske
7bcf4508be Use ternary operator 2016-12-12 19:24:32 +00:00
Devin Teske
0e638f57e6 If you're not going to make use of the products of a match() in awk
(e.g., RSTART and RLENGTH variables) then use ~ instead of match()
2016-12-12 19:12:31 +00:00
Devin Teske
71ef4d586a Now that these variables do not contain the --default-item flag itself,
change the name of the variable from $def_item_... to $default_...
2016-12-12 19:10:39 +00:00
Devin Teske
86e1d2977f Always pass --default-item parameter to dialog 2016-12-12 19:09:17 +00:00
Devin Teske
48e9fce2f5 There is zero harm in always passing --default-item to dialog 2016-12-12 19:07:42 +00:00
Devin Teske
58dc38bd1c Centralize backtitle string 2016-12-12 19:01:04 +00:00
Devin Teske
5357f8f7c8 Use provided API instead of hard-coded status integers 2016-12-12 18:55:41 +00:00
Devin Teske
76b07bd950 Whitespace 2016-12-12 18:52:22 +00:00
Devin Teske
9ca8b7be34 Remove unnecessary `-n' parameter to head/tail 2016-12-12 18:48:00 +00:00
Devin Teske
3204364296 awk(1) match() takes a regex, use /.../ to remind ourselves of this
NB: The difference between "..." and /.../ for a regex in awk is that
quoted strings go through escape expansion first (e.g., \\ becomes \)
2016-12-12 18:45:52 +00:00
Devin Teske
4fa8c81cc3 Be internally consistent (": > ..." is used elsewhere in this file) 2016-12-12 18:43:42 +00:00
Devin Teske
edcf330372 "echo | sed | sed | awk" is silly (changed to "echo | awk") 2016-12-12 18:42:55 +00:00
Devin Teske
1cac9fc2a3 Add missing `-e' parameter to sed invocations 2016-12-12 18:39:26 +00:00
Devin Teske
8d5182d698 Allow $BSDINSTALL_TMPETC to contain whitespace or special chars 2016-12-12 18:38:18 +00:00
Devin Teske
c62801e26d Group fallbacks together 2016-12-12 18:34:21 +00:00
Devin Teske
0b04945dc0 Remove unnecessary quotes around number in test 2016-12-12 18:33:40 +00:00
Devin Teske
e9c843adc7 Change "[ ! ... ] && ..." to "[ ... ] || ..." 2016-12-12 18:29:24 +00:00
Devin Teske
e20253348d Collapse tiny if statements 2016-12-12 18:28:20 +00:00
Devin Teske
114a587e3b Replace funny block with something easy to digest 2016-12-12 18:24:41 +00:00
Devin Teske
bede070805 Consolidate locals 2016-12-12 18:21:56 +00:00
Devin Teske
5b57fabb45 Remove unnecessary local initializers 2016-12-12 18:20:56 +00:00
Devin Teske
38a9942347 Change "[ ! -z ... ]" => "[ ... ]" and "[ -z ... ]" => "[ ! ... ]" 2016-12-12 18:17:30 +00:00
Devin Teske
138ab67af4 Use $( ... ) instead of ... 2016-12-12 18:10:33 +00:00
Devin Teske
97a4c9f0dc Comments 2016-12-12 18:05:54 +00:00
Devin Teske
f18789d787 Functions in their own section 2016-12-08 19:28:12 +00:00
Devin Teske
3d2b0857bf Remove unnecessary trailing backslashes 2016-12-08 19:26:22 +00:00
Devin Teske
3220bdd85c Add support for "hidden" Wi-Fi networks
PR:		bin/214933
Submitted by:	Maxim Filimonov <che@bein.link>
Reviewed by:	dteske, allanjude, adrian
MFC after:	6 days
X-MFC-with:	Follow-up commit for style
2016-12-08 16:41:18 +00:00
Wojciech Macek
e24e98d090 bsdinstall: add warning when unsupported partition is modified
Right now is possible to modify bootable partition type to
non-bootable type without getting warning from partedit.
Example: if you auto parition drive for arm64, you will
get freebsd-ufs as bootable partition; now you are able
to change bootable partition type to freebsd-zfs; there
will be no warning and the system will install but
will not be bootable afterwards.

After this fix, partedit will issue the same warning it
does when user attempts to create bootable partition of
not supported type, notyfing a user about incoming
problem and allowing to think the decision over before
commiting the schema.

This has been tested on amd64 and arm64.

Obtained from:         Semihalf
Submitted by:          Dominik Ermel <der@semihalf.com>
Sponsored by:          Cavium
Reviewed by:           nwhitehorn
Differential Revision: https://reviews.freebsd.org/D6879
2016-09-05 08:42:36 +00:00
Dag-Erling Smørgrav
47ead00d5b Ensure that the sector size is a multiple of 4096 to avoid creating
unaligned partitions when the actual sector size is hidden from us.

PR:		211361
MFC after:	3 days
2016-08-15 09:30:21 +00:00
Steven Kreuzer
1d01cb0d72 Write kern.randompid to /etc/sysctl.conf
PR:		211471
Reported by:	survo@protonmail.com
Reviewed by:	robak@
Approved by:	allanjude@
MFC after:	3 days
Differential Revision:	 https://reviews.freebsd.org/D7440
2016-08-09 15:57:37 +00:00
Dimitry Andric
7212134272 Fix non-functional bsdinstall services dialog.
The most recent version of bsdinstall does not seem to respect any of
the checkboxes in the "Choose the services you would like to be started
at boot" dialog.  None of the chosen services end up in the rc.conf file
that is installed onto the target system.

This is caused by the bsdinstall/scripts/hardening script, which
implements the new hardening options dialog.  The script starts by
overwriting the previously written rc.conf.services file:

    echo -n > $BSDINSTALL_TMPETC/rc.conf.services

which is obviously incorrect.  It should clear out rc.conf.hardening
instead.

Reviewed by:	allanjude
PR:		211506
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D7387
2016-08-01 19:49:42 +00:00
Allan Jude
1b63cafb63 A failed installation once restarted will often error out
If an encrypted install is attempted and fails for any reason, the disk
cannot be erased by the installer because the partition is in use by GELI

At the start of the installation process, all ZFS pools are exported and
all GELI instances are detached, to allow a restarted install to proceed

PR:		210814
Reported by:	jonathan
MFC after:	10 days
2016-07-16 19:35:04 +00:00
Allan Jude
4487af02ff Fix encrypted MBR install
The pools are exported and reimported in order to write the bootcode
This causes an error when the bootpool is later mounted by common code
The bootpool is now imported with the -N flag to prevent mounting

Reported by:	Michael Dexter
MFC after:	5 days
2016-07-16 18:28:44 +00:00
Bartek Rutkowski
0e3f233f51 Add new System Hardening menu and options to bsdinstall.
This patch add new 'hardening' file responsible for new bsdinstall
'System Hardening' menu allowing users to set some sane and carefully
picked system security options (like random process id's, hiding
other users/groups processes and others).

All options are OFF by default in this patch due to POLA principle
with intention to turn change some of them to ON by default in future.

Reviewed by:	adrian, allanjude, bdrewery, nwhitehorn
Approved by:	adrian, allanjude
MFC after:	7 days
2016-07-15 15:07:24 +00:00
Allan Jude
d4e5caaf7d Make the new 'set date and time' dialog default to skip
X-MFC-With:	302790
Requested by:	nwhitehorn
2016-07-14 00:41:19 +00:00
Allan Jude
09c4000afe bsdinstall: Prompt user to set the date and time after selecting timezone
Not having the correct date and time makes many PKI based things not work

In 10 and 11, it can mean that Unbound, ntpd, and sshd won't start

Submitted by:	des (original patch)
MFC after:	7 days
2016-07-13 23:49:45 +00:00
Allan Jude
e302644618 Add more machines to the bsdinstall workaround blacklist
Apply the LenovoFix (fake partition in pMBR is 2nd rather than 1st)
and GPT Active fix (mark the fake pMBR partition active) to respective
hardware that is confirmed to require such to boot correct.

Submitted by:	Sam Fourman Jr. <sfourman@gmail.com> (ThinkPad W520)
Submitted by:	Matthias Apitz <guru@unixarea.de> (Latitude E6330)
Approved by:	re (gjb)
Sponsored by:	ScaleEngine Inc.
2016-07-03 01:23:38 +00:00
Allan Jude
ca13d5d23a Fix an error in bsdinstall when ZFS installation uses a bootpool
A separate bootpool is used when the selected partition type is MBR
or when the disk is GELI encrypted and a UEFI loader is selected.

BIOS avoids the bootpool by using bootcode and loader that support GELI.

bsdinstall did not remount the bootpool after creating the main pool,
which caused an error when mkdir tried to create /boot/zfs

PR:		210717
Approved by:	re (gjb)
Sponsored by:	ScaleEngine Inc.
2016-07-03 01:22:59 +00:00
Ed Maste
5fafcca757 bsdinstall: increase EFI partition size to 200MB
A larger EFI file system size will facilitate multi-boot configurations
and the installation other EFI applications like firmware update tools.
200MB matches OS X.

Note that this changes only the partition size, not the file system that
bsdinstall places there. We need to do both, but as the partition size
is difficult to adjust later make this change for now so that at least
systems installed with FreeBSD 11.0 have a partition layout with room
to grow.

Reviewed by:	allanjude, imp
Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6935
2016-06-23 18:04:48 +00:00
Wojciech Macek
0fbcaf7657 ARM64: bsdinstall support for creating EFI partitions
This patch enables bsdinstall to create EFI partition during installation and uploading it's contents,
    making the ARM64 FreeBSD installation bootable.

    Obtained from:         Semihalf
    Sponsored by:          Cavium
    Approved by:           re
    Reviewed by:           allanjude, emaste, nwhitehorn, wma
    Differential Revision: https://reviews.freebsd.org/D6853
2016-06-20 06:40:58 +00:00
Allan Jude
52fffe9307 Fix bsdinstall for root-on-zfs with MBR partitioning
Fix an error where vfs.root.mountfrom was not always set as required
when creating a bootpool. After the recent geliboot changes, it was only
set if the main pool was encrypted.

Also resolve an error where the bootpool was unmounted twice causing
bsdinstall to stop with an error message about the failed command.

Approved by:	re (gjb)
Sponsored by:	BSDCan Hacker Lounge
2016-06-10 14:31:59 +00:00
Andriy Voskoboinyk
4913f849ab bsdinstall: add country/regulatory domain configuration dialog.
Allow to setup country and/or regulatory domain before scanning
(since channel list is affected by regulatory restrictions this may
impact scan results).

PR:		182600 (originally)
Differential Revision:	https://reviews.freebsd.org/D6325
2016-06-08 20:42:35 +00:00
Andriy Voskoboinyk
fb82771908 bsdinstall: unbreak static address assignment for wired networks.
This fixes regression introduced in r298946 (fixes static address
assignment for wireless networks).

Reported & submitted by:	allanjude
2016-05-26 11:58:36 +00:00
Allan Jude
24d17f1e24 Only set kern.geom.part.mbr.enforce_chs=0 once, instead of once per disk
Sponsored by:	ScaleEngine Inc.
2016-05-24 00:23:39 +00:00
Allan Jude
bb4fd0a0d1 Add support for RAID 1+0 (striped mirrors) to bsdinstall/zfsboot
Sponsored by:	ScaleEngine Inc.
2016-05-24 00:22:29 +00:00
Allan Jude
b06bc65e71 Only export and re-import the root pool if installing on MBR
This step is required in order to dd the boot2 bits into the ZFS partition

Sponsored by:	ScaleEngine Inc.
2016-05-23 17:04:13 +00:00
Allan Jude
7289f18f78 Fix missing pool name in zfs set command 2016-05-23 16:49:26 +00:00
Allan Jude
dcf362194d Fix error in bsdinstall where additional filesystems cannot be mounted
Do not set canmount=noauto on the boot environment at create time, because
this causes / to not be mounted, and since the chroot is read only, new
mountpoints cannot be created.

The property is set later, when other properties are adjusted

Reported by:	HardenedBSD
Sponsored by:	ScaleEngine Inc.
2016-05-23 15:11:01 +00:00
Allan Jude
a1b8f55c77 bsdinstall/zfsboot GPT+BIOS+GELI installs now make use of GELIBOOT
In this configuration, a separate bootpool is not required.
This allows ZFS Boot Environments to be used with GELI encrypted ZFS pools.

Support for GPT+EFI+GELI is planned for the future.

Tested by: Joseph Mingrone, HardenedBSD
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D5869
2016-05-22 20:31:52 +00:00
Allan Jude
595568b58b Fix default ZFS layout to work better by default with sysutils/beadm
The root file system is mounted early via vfs.root.mountfrom.
The canmount=noauto property only affects the zfs rc.d script.
This ensures that the 'default' BE is not mounted overtop of another BE when
one is selected from the beastie menu

Sponsored by:	ScaleEngine Inc.
2016-05-22 16:24:21 +00:00
Baptiste Daroussin
5e38260c4f Fix typo in comments for the zfsboot script
Submitted by:	Colby Swandale <colby@taplaboratories.com.au> (via github)
2016-05-22 12:59:07 +00:00
Allan Jude
06445fc0fa bsdinstall/zfsboot: Do not mirror swap when swapsize is 0
PR:		209415
Submitted by:	Ganael LAPLANCHE <ganael.laplanche@corp.ovh.com>
MFC after:	2 weeks
2016-05-10 14:38:43 +00:00
Andriy Voskoboinyk
6d8e01b078 bsdinstall: fix static address assignment for protected wireless networks.
Filter out IFCONFIG_PREFIX variable (which may contain WPA keyword)
from ifconfig parameters.

PR:		169199
2016-05-02 21:40:34 +00:00
Pedro F. Giffuni
ec65e4f8d0 usr.sbin/bsdconfig: minor spelling fixes on comments.
No functional change.
2016-05-01 16:38:12 +00:00
Ed Schouten
4e7e2cad09 Remove unportable calls to basename().
The POSIX version of basename() doesn't use a 'const char *' argument;
the function may overwrite its input buffer. Instead of copying the
input string, let's just simplify this code by using our getprogname()
function that already returns the name of the application in the right
format.

Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D6094
2016-04-26 10:04:06 +00:00
Allan Jude
4d41f47272 Add a new installation type to bsdinstall/zfsboot: BIOS+UEFI
Installs both pmbr+gptzfsboot as well as boot1.efifat in separate partitions
The resulting system can be booted with either UEFI or BIOS/CSM.
Preference is controlled by the user's firmware boot settings.

This is now the default for zfsboot installs

PR:		208629
Submitted by:	Galael LAPLANCHE <ganael.laplanche@corp.ovh.com> (original version)
2016-04-19 03:25:36 +00:00
Glen Barber
876d357fa7 MFH
Sponsored by:	The FreeBSD Foundation
2016-04-11 15:24:59 +00:00
Allan Jude
b3f7b13945 bsdinstall/zfsboot should create /tmp and /var/tmp if they do not exist
PR:		208629
PR:		208568
Submitted by:	Galael LAPLANCHE <ganael.laplanche@corp.ovh.com>
MFC after:	2 weeks
2016-04-08 15:08:22 +00:00
Allan Jude
6b5e33ba48 Do not add swap to fstab when swapsize is 0
If a user requested encrypted swap, but 0 sized, it would still be added to fstab

PR:		208630
Submitted by:	Ganael LAPLANCHE <ganael.laplanche@corp.ovh.com>
MFC after:	2 weeks
Sponsored by:	ScaleEngine Inc.
2016-04-08 15:05:06 +00:00
Glen Barber
d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Allan Jude
6203e46b84 Remove 50% ZFS conditional from bsdinstall/zfsboot
Remove the requirement that the resulting partition table be atleast 50% ZFS

PR:		208094
Requested by:	brooks
Sponsored by:	ScaleEngine Inc.
2016-03-17 17:53:38 +00:00
Glen Barber
221b349912 MFH
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:27:48 +00:00
Allan Jude
0edc8cc831 The zfsboot automated part of bsdinstall now supports UEFI
MFC after:	3 days
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D4960
2016-01-30 15:53:28 +00:00
Glen Barber
59d43d11fe MFH
Sponsored by:	The FreeBSD Foundation
2016-01-20 09:50:54 +00:00
Allan Jude
a94af9543d Never 4k align the MBR bootpool because zfsldr can not deal with a gap
If the bootpool does not start at the first sector of the BSD partition
then zfsldr seeks to the wrong offset inside the ZFS vdev label, and is
unable to find zfsboot, so the system does not boot

If 4k alignment is requested, align the BSD partition in the MBR table,
and align the swap and data pool, but the bootpool must start at sector 1

While here, if 4k alignment is requested, disable MBR CHS alignment, as
this results in not-4k aligned partitions.

Reported by:	Alex Wilkinson
MFC after:	5 days
Sponsored by:	ScaleEngine Inc.
2016-01-16 19:25:16 +00:00
Glen Barber
a11378bd93 MFH
Sponsored by:	The FreeBSD Foundation
2016-01-14 13:29:12 +00:00
Eric van Gyzen
50d901977a bsdinstall: Suggest the GPT+Active workaround on Dell T5810
The Dell Precision Tower 5810 fails to boot from GPT in Legacy/BIOS mode
without the Active flag in the Protective MBR.  Suggest the workaround
during installation.

Since an increasing number of Dell systems exhibit this behavior,
I imagine all Dells past a certain date will do so.  I would like
to suggest the workaround for all Dells with a BIOS date of, say,
2014 or later, but I would need to test a variety of systems before
committing such a change.

Reviewed by:	allanjude, dteske
MFC after:	5 days
Relnotes:	We should probably suggest using GPT+Active on "recent" Dells.
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D4075
2016-01-14 00:31:00 +00:00
Glen Barber
1a5c9277ca MFH
Sponsored by:	The FreeBSD Foundation
2016-01-05 21:12:49 +00:00
Glen Barber
8834318685 Merge ^/projects/release-install-debug:
- Rework MANIFEST generation and parsing via bsdinstall(8).
- Allow selecting debugging distribution sets during install.
- Rework bsdinstall(8) to fetch remote debug distribution sets
  when they are not available on the local install medium.
- Allow selecting additional non-GENERIC kernels during install.
  At present, GENERIC is still required, and installed by default.

Tested with:	head@r293203
Sponsored by:	The FreeBSD Foundation
2016-01-05 21:05:17 +00:00
Glen Barber
b626f5a73a MFH r289384-r293170
Sponsored by:	The FreeBSD Foundation
2016-01-04 19:19:48 +00:00
Devin Teske
ed27536fd5 Explicitly set permissions on entropy files
Differential Revision:	https://reviews.freebsd.org/D3933
Submitted by:	jmg
Reviewed by:	delphij, markm
Approved by:	secteam (delphij)
MFC after:	3 days
X-MFC-to:	stable/10 stable/9
2015-12-28 17:27:20 +00:00
Nathan Whitehorn
159ca5c844 Adapt to new wireless scheme where base wlan interfaces do not show up in
ifconfig anymore.
2015-12-06 00:20:45 +00:00
Bryan Drewery
7fdd45b091 Use LIBEXECDIR for /usr/libexec.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-26 01:14:40 +00:00
Devin Teske
e4e2a6c642 Fix typo in error message
Differential Revision:	https://reviews.freebsd.org/D3997
Submitted by:	git_johnko.ca (John Ko)
MFC after:	3 days
X-MFC-to:	stable/10 stable/9
2015-11-03 21:19:46 +00:00
Baptiste Daroussin
5a2b666ce5 Merge from head 2015-10-01 09:36:43 +00:00
Bryan Drewery
595fe15108 Add more SUBDIR_PARALLEL.
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-26 14:13:51 +00:00
Bryan Drewery
ec766071e3 META_MODE: Remove DEP_MACHINE from Makefile.depend files.
This has not been needed since r246865 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:44:01 +00:00
Bryan Drewery
54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00
Allan Jude
4c95e76ac4 Add a number of models to the bsdinstall GPT hack blacklist
PR:		194359
Approved by:	bapt (mentor)
MFC after:	2 weeks
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3525
2015-09-16 03:32:27 +00:00
Baptiste Daroussin
f94594b37a Finish merging from head, messed up in previous attempt 2015-09-12 12:03:02 +00:00
Baptiste Daroussin
b5ff185e19 Merge from head 2015-09-12 11:41:31 +00:00
Devin Teske
65f3614085 Replace `return' outside of function with exit
MFC after:	3 days
X-MFC-to:	stable/10
Pointy hat to:	me
2015-09-11 21:18:21 +00:00
Devin Teske
0a8354938c Use a variable for readability
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 21:14:48 +00:00
Devin Teske
e5a24129fa Update copyright
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 21:13:34 +00:00
Devin Teske
96eeaba5b1 Better to reset trap and explicitly exit success
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 21:12:41 +00:00
Devin Teske
521414ebc7 Remove trailing newline at EOF
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 21:09:39 +00:00
Devin Teske
5e1ed71e4f Produce meaningful exit code
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 21:08:46 +00:00
Devin Teske
1a8cf17d01 Explicitly exit with success
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 21:01:26 +00:00
Devin Teske
0705286bfb Explicitly exit with success
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 20:59:13 +00:00
Devin Teske
fef95330a8 Update copyrights
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 20:58:00 +00:00
Devin Teske
cc478f6fd3 Produce meaningful exit code
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 20:56:36 +00:00
Devin Teske
527a9f3a85 Remove use of return outside of function
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 20:45:41 +00:00
Devin Teske
ff7b134cfa Ignore error results from newaliases(1)
MFC after:	3 days
X-MFC-to:	stable/10
2015-09-11 20:39:41 +00:00
Glen Barber
1da17fb7be Ensure the local MANIFEST is always used when verifying remote
distribution sets.

MFC after:	immediately
Sponsored by:	The FreeBSD Foundation
2015-08-04 13:40:26 +00:00
Allan Jude
a7d5d8d9d0 Add the Dell E7240 laptop and Intel DP965LT motherboard to the list for the GPT active workaround
PR:		194359
Requested by:	sbruno, hiren
Approved by:	marcel
MFC after:	3 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3139
2015-07-21 00:33:15 +00:00
Allan Jude
7059fa6ff8 Add support for two workarounds for known issues booting GPT in legacy mode on some hardware
For Lenovo laptops with buggy bios (x220, t420, t520):
	Write the 0xee entry into the second slot in the pmbr instead of the first

For some Dell and HP models:
	The BIOS gives a warning message when booting in legacy mode from a GPT partitioned disk where the 0xee partition in the pmbr is not flagged active
	For models known to have this problem, mark the pmbr active during installation

Use smbios data to identify machines known to be affected by any of the above, and offer the user the option to apply the workaround

In bsdinstall's ufs auto mode (autopart partition wizard):
	Allow users to select which type of partition table to use
	Keep current defaults: MBR for BIOS, GPT for UEFI
	This allows users to choose GPT for legacy boot if they wish

PR:		184910
PR:		194359
Reviewed by:	Michael Dexter
Approved by:	marcel
MFC after:	3 days
X-MFC-With:	r285594
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3091
2015-07-18 18:49:44 +00:00
Allan Jude
69e4b249f8 Make bsdinstall's zfsboot script align partitions to 4k/1m when the user requests it
PR:		195174
Reviewed by:	darius
Approved by:	brueffer
MFC after:	3 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3062
2015-07-14 19:57:10 +00:00
Allan Jude
7e3ebc5b0a Set a mountpoint on the root of the pool so user-created datasets have a mountpoint to inherit
Reviewed by:	darius
Approved by:	brueffer
MFC after:	3 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3063
2015-07-14 19:42:40 +00:00
Allan Jude
1bc080435c Have bsdinstall's zfsboot script make /var/audit its own dataset, so it is not part of the OS boot environment
PR:		199864
Submitted by:	Jason Unovitch
Approved by:	brueffer
MFC after:	3 days
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D2861
2015-07-14 19:38:26 +00:00
Allan Jude
4ffa3da5f8 Fix a typo in bsdinstall
A variable was misspelled resulting in chmod executing on the installer instead of on the target chroot

PR:		191402
Submitted by:	Martin Simmons <martin@lispworks.com>
Approved by:	brueffer
MFC after:	3 days
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3061
2015-07-13 17:40:24 +00:00
Baptiste Daroussin
dad2fb7ece Merge from head 2015-06-15 10:56:01 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Glen Barber
37a48d408f MFH: r282615-r283655
Sponsored by:	The FreeBSD Foundation
2015-05-28 17:06:50 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Allan Jude
dce663816a Fix a syntax error in bsdinstall/zfsboot
Differential Revision:	https://reviews.freebsd.org/D2571
Submitted by:	Michael Dexter
Approved by:	dteske
MFC after:	1 week
X-MFC-With:	r283023, r282443
Sponsored by:	ScaleEngine Inc.
2015-05-22 15:57:42 +00:00
Allan Jude
caa3817d4f bsdinstall/zfsboot: Skip adding swap lines to /etc/fstab if swap is 0 sized
Differential Revision:	https://reviews.freebsd.org/D2571
Reviewed by:	dim
Approved by:	eadler (mentor)
Sponsored by:	ScaleEngine Inc.
2015-05-17 00:55:44 +00:00
Baptiste Daroussin
3deada4168 Merge from HEAD 2015-05-07 23:18:23 +00:00
Allan Jude
169ff110e8 Add a sanity check to the swap size in zfsboot of bsdinstall
Loop until the user enters a valid size (>100mb or 0)

Differential Revision:	https://reviews.freebsd.org/D2299
Reported By:	Shawn Webb
Reviewed by:	roberto
Approved by:	brd
MFC after:	2 weeks
Sponsored by:	ScaleEngine Inc.
2015-05-05 03:08:49 +00:00
Baptiste Daroussin
7757a1b4dc Merge from head 2015-05-03 19:30:11 +00:00
Devin Teske
43d4f8c4c6 Add "GELI Passphrase:" prompt to boot loader.
A new loader.conf(5) option of geom_eli_passphrase_prompt="YES" will now
allow you to enter your geli(8) root-mount credentials prior to invoking
the kernel.

See check-password.4th(8) for details.

Differential Revision:	https://reviews.freebsd.org/D2105
Reviewed by:	imp, kmoore
Discussed on:	-current
MFC after:	3 days
X-MFC-to:	stable/10
Relnotes:	yes
2015-04-16 20:53:15 +00:00
Devin Teske
1ebd9bd41c Unbreak ZFS+GELI install option.
Reported by:	delphij
Submitted by:	delphij
Pointy hat to:	dteske (me)
MFC after:	3 days
X-MFC-to:	stable/10 stable/9
X-MFC-with:	r281160
2015-04-06 19:26:45 +00:00
Devin Teske
4ef4026223 Fix permissions on ZFS root encryption key (644 -> 600).
MFC after:	3 days
X-MFC-to:	stable/10 stable/9
Security:	CVE-2015-1415
Reported by:	Pierre Kim
2015-04-06 18:03:35 +00:00
Baptiste Daroussin
4bf53d0b46 Merge from HEAD 2015-04-03 23:23:09 +00:00
Devin Teske
8a416b59fb Whoops! "arc commit --revision" != "arc diff --update" 2015-04-01 02:05:26 +00:00
Devin Teske
ba22fa80f2 Add "GELI Passphrase:" prompt to boot loader.
Summary:
Add "GELI Passphrase:" prompt to boot loader.

A new loader.conf(5) option of geom_eli_passphrase_prompt="YES" will now
allow you to enter your geli(8) root-mount credentials prior to invoking
the kernel.

See check-password.4th(8) for details.

Differential Revision:	https://reviews.freebsd.org/D2105
Reviewed by:	(your name[s] here)
MFC after:	3 days
X-MFC-to:	stable/10
Relnotes:	yes

Test Plan:
Drop a head copy of check-password.4th into /boot and then apply the patch
(only the patch to /boot/check-password.4th is required; no other changes are
required but you do have to have a HEAD copy of check-password.4th to
apply the patch).

NB: The rest of your /boot files can be up to 2 years old but no older.
NB: The test won't work unless your kernel has the following change

https://svnweb.freebsd.org/base?view=revision&revision=273489

Now, put into /boot/loader.conf:

geom_eli_passphrase_prompt="YES"

and reboot.

You should be prompted for a GELI passphrase before the menu (if enabled),
just after loading loader.conf(5).

NB: It doesn't matter if you're using GELI or not. However if you are using
GELI and a sufficiently new enough release (has SVN r273489) and you entered
the proper passphrase to mount your GELI encrypted root device(s), you should
notice that the boot process did not stop (you went from loader all the way to login).

Reviewers: cperciva, allanjude, scottl, kmoore

Subscribers: jkh, imp

Differential Revision: https://reviews.freebsd.org/D2105
2015-04-01 02:01:34 +00:00
Devin Teske
febd9e9c94 Update copyright(s)
MFC after:	3 days
X-MFC-to:	stable/10
2015-03-21 03:54:11 +00:00
Devin Teske
33112d9e9f Whitespace cleanup(s).
MFC after:	3 days
X-MFC-to:	stable/10
2015-03-21 03:52:43 +00:00
Allan Jude
efd6e672e4 Remove a non-required unsafe condition added in the previous commit
Reviewed by:	bapt
Approved by:	dteske
Sponsored by:	ScaleEngine Inc.
2015-03-18 23:47:30 +00:00
Allan Jude
d421870917 Fix the handbook install option in bsdinstall
bsdconfig's f_package_add doesn't seem to support using the pkg repo from /etc/pkg/FreeBSD.conf, it also tries to run the commands on the installer image, not in the destination chroot

Instead, manually bootstrap pkg in the chroot, and then install the requested packages (in the chroot)

Doesn't use pkg -c, because pkg is not installed on the installer image

PR:		196250
Differential Revision:	https://reviews.freebsd.org/D2026
Approved by:	bapt
Sponsored by:	ScaleEngine Inc.
2015-03-18 23:24:38 +00:00
Baptiste Daroussin
842294c1ff Add a bsdinstall package 2015-03-18 12:28:17 +00:00
Nathan Whitehorn
04e98a3724 Use MBR by default on BIOS systems. An increasing number of motherboards
assume that GPT means UEFI boot, resulting in the installation of
uninstallable systems. This needs a little more work before MFC, in
particular based on disk size (> 2 TB + BIOS + MBR is not workable). That
will come soon.
2015-01-30 21:22:18 +00:00
Steven Hartland
e751d176f3 Fix bsdinstall when working with geli boot disks
PR:		196790
Differential Revision:	https://reviews.freebsd.org/D566
Submitted by:	Michael Gmelin <grembo@FreeBSD.org>
MFC after:	2 weeks
Sponsored by:	Multiplay
2015-01-18 18:25:12 +00:00
Joel Dahl
f7e00d4bbd mdoc: remove EOL whitespace. 2014-12-29 13:50:59 +00:00
Steven Hartland
b4843bd68b Switch zfsboot installer force 4K option to use vfs.zfs.min_auto_ashift=12
Previously we used gnop(8) to fake 4K sector size disks but ZFS now has a
sysctl to control this when creating new top level vdev's so use that
instead.

Differential Revision:	D566
MFC after:	1 month
Sponsored by:	Multiplay
2014-12-21 17:21:29 +00:00
Devin Teske
4ff1fc3b17 In bsdinstall's distextract, replace mixed_gauge() of dialog(3) with
new dpv(3) wrapper to dialog(3) dialog_gauge(). The dpv(3) library provides
a more flexible and refined interface similar to dialog_mixedgauge() however
is implemented atop the more generalized dialog_gauge() for portability.
Noticeable improvements in bsdinstall's distextract will be a status line
showing data rate information (with support for localeconv(3) to format
numbers according to $LANG or $LC_ALL conversion information), i18n support,
improved auto-sizing of gauge widget, a ``wheel barrow'' to keep the user
informed that things are moving (even if status/progress has not changed),
improved color support (mini-progress bars use the same color, if enabled,
as the main gauge bar), and several other improvements (some not visible).
dpv stands for "dialog progress view" (dpv was introduced in SVN r274116).

Differential Revision:	https://reviews.freebsd.org/D714
Discussed on:	-current
Reviewed by:	julian
MFC after:	3 days
X-MFC-to:	stable/10
Relnotes:	Improved installer feedback from bsdinstall distextract
2014-12-18 03:51:09 +00:00
Baptiste Daroussin
c6db8143ed Convert usr.sbin to LIBADD
Reduce overlinking
2014-11-25 16:57:27 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Nathan Whitehorn
5b9ee78d49 Rewrite some of the disk setup documentation to be clearer and contain
less obsolete information. Also move the entropy command down the list --
the list is ordered by likelihood of use rather than alphabetically.

MFC after:	1 week
2014-10-31 23:52:02 +00:00
Nathan Whitehorn
403a3c8c82 Only allow ZFS boot on GPT; the MBR ZFS bootblocks cannot be installed using
gpart bootcode as /boot/zfsboot needs to be split into multiple pieces by
hand and copied to different areas of the partition.
2014-10-12 17:59:31 +00:00
Nathan Whitehorn
be01d6e9f2 Centralize determination of boot firmware (UEFI vs. BIOS/CSM) into a
function x86_bootmethod() and fix deviations from style(9).
2014-10-12 17:50:25 +00:00
Devin Teske
bd1df63614 Optimize program flow for execution speed. Also fix some more style(9) nits
while here:
+ Fix an issue when extracting small archives where dialog_mixedgauge was
  not rendering; leaving the user wondering if anything happened.
+ Add #ifdef's to assuage compilation against older libarchive
  NB: Minimize diff between branches; make merging easier.
+ Add missing calls to end_dialog(3)
+ Change string processing from strtok(3) to strcspn(3) (O(1) optimization)
+ Use EXIT_SUCCESS and EXIT_FAILURE instead of 0/1
+ Optimize getenv(3) use, using stored results instead of calling repeatedly
  NB: Fixes copy/paste error wherein we display getenv(BSDINSTALL_DISTDIR) in
      an error msgbox when chdir(2) to getenv(BSDINSTALL_CHROOT) fails
      (wrong variable displayed in msgbox).
+ Use strtol(3) instead of [deprecated] atoi(3)
+ Add additional error checking (e.g., check return of archive_read_new(3))
+ Assign DECONST strings to static variables
+ Fix typo in distextract.c error message (s/Could could/Could not/)
+ Add comments and make a minor whitespace adjustment

Reviewed by:	nwhitehorn, julian
2014-10-01 18:59:57 +00:00
Devin Teske
82ac9f2bf7 Use snprintf(3) in place of unbounded sprintf(3) (prevent buffer overflow).
Use adequately sized buffer for error(s) (512 -> PATH_MAX + 512).
Fix the following style(9) nits while here:
- distfetch.c uses PATH_MAX while distextract.c uses MAXPATHLEN;
  standardize on one (PATH_MAX)
- Move $FreeBSD$ from comment to __FBSDID()
- Sort included headers (alphabetically, sys/* at top)
- Add missing header includes (e.g., <stdlib.h> for getenv(3),
  calloc(3)/malloc(3)/free(3), and atoi(3); <string.h> for strdup(3),
  strrchr(3), strsep(3), and strcmp(3); <ctype.h> for isspace(3); and
  <unistd.h> for chdir(2), etc.)
- Remove rogue newline at end of distfetch.c
- Don't declare variables in if-, while-, or other statement
NB: To prevent masking of prior declarations atop function
- Perform stack alignment for variable declarations
- Add missing function prototype for count_files() in distextract.c
- Break out single-line multivariable-declarations
NB: Aligning similarly-named variables with one-char difference(s)
NB: Minimizes diffs and makes future diffs more clear
- Use err(3) family of functions (requires s/int err;/int retval;/g)

Reviewed by:	nwhitehorn, julian
2014-09-29 00:35:12 +00:00
Allan Jude
1aec0f4f91 Change the /var dataset in the default ZFS layout to have the
ZFS property canmount=off so that /var/db/pkg and other such directories
are part of the / dataset, and only /var/mail, /var/log, and /var/crash
are excluded from the ZFS boot environment (beadm).

PR:		193971
Approved by:	jmg
MFC after:	ASAP
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
2014-09-28 21:44:23 +00:00
Dag-Erling Smørgrav
58eb9abb31 Add a line to the post-installation configuration dialog to enable the
local_unbound service.

MFC after:	3 days
2014-09-26 11:38:10 +00:00
Nathan Whitehorn
d73bf00760 ZFS support isn't actually experimental anymore, so no need to scare
people.
2014-09-14 02:31:53 +00:00
Allan Jude
1230701891 Make the root-on-zfs part of the installer warn a user who booted the installer via UEFI that we do not support booting ZFS via UEFI yet
PR:		193595
Approved by:	nwhitehorn
MFC after:	5 days
Sponsored by:	ScaleEngine Inc.
CR:		https://reviews.freebsd.org/D782
2014-09-14 01:57:22 +00:00
Nathan Whitehorn
7c1db22805 Rename the choices in the partitioning methods dialog to reflect current
reality. In particular, draw a connection between the auto ZFS script and
the auto UFS one, since they fulfill similar functions. I'm not sure the
auto ZFS code is actually experimental anymore, so it might be worth
changing that label still.
2014-09-13 22:14:19 +00:00
Nathan Whitehorn
44a25dd6c6 Make the default choice for the chroot shell at the end be "No". This allows
just pressing enter repeatedly to successfully install a reasonable system.
2014-09-13 22:03:51 +00:00
Nathan Whitehorn
6e15678a47 Add ZFS support to the bsdinstall partition editor and sade.
Submitted by:	Kurt Lidl (original version)
MFC after:	6 weeks
2014-09-13 18:24:54 +00:00
Stefan Eßer
f071b64ed3 More man pages that need to know about vt in addition to syscons.
MFC after:	3 dayS
2014-08-26 10:55:08 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Andrew Thompson
7041a67eee Give a brief message as to what error was encountered to help the user along.
Reviewed by:	nwhitehorn
MFC after:	2 weeks
2014-08-07 01:51:01 +00:00
Dag-Erling Smørgrav
a382af08f8 Strip the patch level from the release name before trying to fetch the
distribution.

PR:		170264
Approved by:	nathanw
MFC after:	1 week
2014-07-24 17:43:42 +00:00
Nathan Whitehorn
963ae465d5 Allow up to 512K for boot code on GPT with BIOS. As pmbr.s says in a comment,
"545K should be enough for any boot code". This rounds down slightly.

Reported by:	Matthew Fuller
MFC after:	2 weeks
2014-07-11 23:41:56 +00:00
Nathan Whitehorn
1ee0f08975 After EFI support was added to the installer, it needed to allow boot
partitions of types other than "freebsd-boot" (in particular, "efi").
This allows the removal of some nasty hacks for supporting PowerPC systems,
in particular aliasing freebsd-boot to apple-boot on APM and an IBM-specific
code on MBR.

This changes the installer to use the correct names, which also breaks a
degeneracy in the meaning of "freebsd-boot" that allows the addition
of support for some newer IBM systems that can boot from GPT in addition to
MBR. Since I have no idea how to detect which those systems are, leave
the default on IBM PPC systems as MBR for now.
2014-07-04 15:55:32 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Devin Teske
47206692f2 Fix syntax error thrown at the point of creating the root pool, caused by
an embedded newline appearing within the options string surrounded by
double-quotes. Rework the logic that goes into setting dataset options on
the root pool dataset while we're here -- added two new variables (which
can be altered via scripting) ZFSBOOT_POOL_CREATE_OPTIONS and also
ZFSBOOT_BOOT_POOL_CREATE_OPTIONS for setting pool/dataset attributes at
the time of pool creation. The former is for setting options on the root
pool (zroot) and the latter is for setting options on the optional separate
boot pool (bootpool) implicitly enabled when using either GELI or MBR. The
default value for the root pool variable (ZFSBOOT_POOL_CREATE_OPTIONS) is
"-O compress=lz4 -O atime=off" and the default value for separate boot pool
variable (ZFSBOOT_BOOT_POOL_CREATE_OPTIONS) is NULL (no additional options
for the separate boot pool dataset).

Reviewed by:	allanjude
MFC after:	7 days
X-MFC-with:	r266107-266109
2014-05-22 19:36:29 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Brooks Davis
525e2a83f6 Revert r261296. This removes the WITHOUT_NCURSESW option.
It was the wrong direction.  We will instead remove use of the
non-wide-character supporting libncurses.
2014-05-15 16:44:25 +00:00
Ollivier Robert
695a612f67 Fix the "disks" variable reuse.
It starts off being used to track the grammar for the number of disks
(singular vs plural) and then it is reused as the list of available disks.

Replace the variable with disks_grammar and move 'disk' and 'disks' to
msg_ vars so they can be translated in the future.

Submitted by:	Allan Jude <freebsd@allanjude.com>
Reviewed by:	roberto
MFC after:		2 weeks
Sponsored by:	ScaleEngine Inc.
2014-05-15 02:37:59 +00:00
Ollivier Robert
ed8690e36b Updates to the datasets created by zfsboot.
Set compress=lz4 for the entire pool, removing it from the individual
datasets

Remove exec=no from /usr/src, breaks the test suite.

Submitted by:	Allan Jude <freebsd@allanjude.com>
Reviewed by:	roberto
MFC after:		2 weeks
Sponsored by:	ScaleEngine Inc.
2014-05-15 02:31:02 +00:00
Ollivier Robert
2875e59f52 Here is a patch for the bsdinstall root-on-zfs stuff that adds optional
encryption for swap, and optional gmirror for swap (which can be combined)

Submitted by:	Allan Jude <freebsd@allanjude.com>
Requested By:	roberto
Sponsored By:	ScaleEngine Inc.
MFC after:		2 weeks
2014-05-15 02:27:10 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Nathan Whitehorn
235591a578 Finish connecting up installer UEFI support. If the kernel was booted using
EFI, set up the disks for an EFI system. If booted from BIOS/CSM, set up
for BIOS.
2014-04-27 15:58:07 +00:00
Nathan Whitehorn
6b446ed5ab Add EFI support to the installer. This requires that the kernel provide
a sysctl to determine what firmware is in use. This sysctl does not exist
yet, so the following blocks are in front of the wheels:
- I've provisionally called this "hw.platform" after the equivalent thing
  on PPC
- The logic to check the sysctl is short-circuited to always choose BIOS.
  There's a comment in the top of the file about how to turn this off.

If IA64 acquired a boot1.efifat-like thing (probably with very few
modifications), the same code could be adapted there.
2014-04-26 16:55:38 +00:00
Devin Teske
a88393ce0b Update zfsboot to coincide with r264840 to bsdconfig(8) adding
GEOM support (thereby adding GEOM support to the disk selection
menu of bsdinstall(8)'s `zfsboot' module updated herein).

MFC after:	1 week
X-MFC-with:	264840
2014-04-23 22:06:43 +00:00
Devin Teske
751952ae37 When merging docsinstall and zfsboot updates to stable/9 it was discovered
that the slightly older dialog(1) requires --separate-output when using the
--checklist widget to force response to produce unquoted values (whereas in
stable/10 --checklist widget without --separate-output will only quote the
checklist labels in the response if the label is multi-word (contains any
whitespace).

Since these enhancements (see revisions 263956 and 264437) were developed
originally on 10, the --separate-output option was omitted. When merged to
stable/9, we (Allan Jude) and I found during testing that the "always-
quoting" of the response was causing things like struct interpolation to
fail (`f_struct device_$dev' would produce `f_struct device_\"da0\"' for
example -- literal quotes inherited from dialog(1) --checklist response).

To see the behavior, execute the following on stable/9 versus stable/10:

        dialog --checklist disks: 0 0 0 da0 "" off da1 "" off

Check both items and hit enter. On stable/10, the response is:

        da0 da1

On stable/9 the response is:

        "da0" "da1"

If you use the --separate-output option, the response is the same for both:

        da0
        da1

So applying --separate-output on every platform until either one of two
things occurs 1) dialog(1,3) gets synchronized between stable/9, higher or
2) we drop support for stable/9.

MFC after:      3 days
Reviewed by:    Allan Jude
2014-04-15 06:56:59 +00:00
Devin Teske
4c5d7fab2a Fix typo in debug/log statement.
Submitted by:	Rick Miller <vmiller@hostileadmin.com>
2014-04-14 05:35:01 +00:00
Warner Losh
3bdf775801 NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
and finish the job. ncurses is now the only Makefile in the tree that
uses it since it wasn't a simple mechanical change, and will be
addressed in a future commit.
2014-04-13 05:21:56 +00:00
Bryan Drewery
7e30426f3b Revert r263638 (create /root dataset) for now as it breaks install and needs
more work in cases such as single-user mode.
2014-03-26 13:41:30 +00:00
Bryan Drewery
b116e44cb0 Create a root dataset so that /root is outside of the boot environment.
Discussed with:	dteske on sysinstall@
MFC after:	1 month
2014-03-22 15:59:26 +00:00
Devin Teske
c7684efd3a Add zfsboot to the scripted interface of bsdinstall(8); oops!
NB: If the zfsboot variables ($ZFSBOOT_*) are set, a script is
assumed to want zfsboot module instead of scriptedpart module.

Submitted by:	Loïc Brarda <loic.brarda@cern.ch>
Reviewed by:	nwhitehorn@
MFC after:	3 days
2014-02-16 06:56:44 +00:00
Brooks Davis
38e233371c Merge from CheriBSD:
commit c1acf022c5
Author: Brooks Davis <brooks@one-eyed-alien.net>
Date:   Fri Jan 17 21:46:44 2014 +0000

    Add an option WITHOUT_NCURSESW to suppress building and linking to
    libncursesw.  While wide character support it useful we'd like to
    only need one ncurses library on embedded systems.

MFC after:	4 weeks
Sponsored by:	DARPA, AFRL
2014-01-30 21:08:36 +00:00
Devin Teske
13fba447b4 Dummy commit (whitespace changes and style nits) to show previous commit
(SVN r260866) was [in-part] Submitted-by: Christoph Mallon ...
<christoph.mallon@gmx.de>

MFC After:	3 days
X-MFC-With:	r260866
2014-01-20 03:39:08 +00:00
Devin Teske
e06674ffd2 Fix a bad comparison operator (s/==/=/), and address a use-case issue where-
in the one-line comment associated with the dumpdev setting was not present
for the case where the user deselects the dumpdev service (restoring pre-
r256348 behaviour.

MFC After:	3 days
2014-01-18 22:33:49 +00:00
Gavin Atkinson
093b9154fd Allow bsdinstall to use WPA-Enterprise networks when installing. This
only allows basic username/password config, and does not provide the
ability to set any of the other WPA options.  Regardless, this is
generally sufficient to associate.

Perhaps in the future this could allow full configuring (e.g. being able
to set "anonymous identity", and perhaps some of the more obscure WPA
options), though perhaps that will better belong in bsdconfig when that
grows wlan config ability.

MFC after:	1 week
2014-01-04 17:09:41 +00:00
Gavin Atkinson
ebffa06008 Lower the priority of the "connect to any open wireless network" network
description, so guaranteeing that any other defined network will be tried
first.

MFC after:	1 week
2014-01-04 16:44:05 +00:00
Gavin Atkinson
f051e63a59 Remove what appears to be a stray debugging printf.
MFC after:	1 week
2014-01-04 16:41:43 +00:00
Devin Teske
a36511c287 Move the installer's keymap solution introduced by SVN r259468. The new
location of /etc/rc.local on the install media is more appropriate as it
knows serial vs. non-serial and can also do the change earlier (so that
even the initial Install dialog can benefit from the change).

MFC after:	3 days
2013-12-21 16:43:40 +00:00
Devin Teske
6311cc9efe When using a bootpool, set the cachefile property so that it gets
imported automatically upon reboot to the newly installed system.

MFC after: 1 day
2013-12-19 06:43:52 +00:00
Devin Teske
4b4b90d5a8 Fix a regression that occurred with SVN revisions 259474 and 259476 where
installation to 3-4+ (depending on vdev type) vdevs would result in odd
error messages where the zpool `create' command appeared to repeat itself
(an artifact of printf when you supply too many arguments -- caused by
neglecting to properly quote the multi-word expansion of $*vdevs when
creating the pool(s)). Example error below (taken from bsdinstall_log):

DEBUG: zfs_create_boot: Creating root pool...
DEBUG: zfs_create_boot: zpool create -o altroot=/mnt -m none -f "zroot" \
ada0p3.nop ada1p3.nopzpool create ada2p3.nop "ada3p3.nop"
DEBUG: zfs_create_boot: retval=1 <output below>
cannot open 'ada1p3.nopzpool': no such GEOM provider
2013-12-19 06:41:30 +00:00
Devin Teske
2d5cf580aa In bsdinstall_log, it's rather confusing to see the following sequence:
DEBUG: Running installation step: hostname
  rm: /tmp/bsdinstall_etc/fstab: No such file or directory

The two lines are unrelated, and the rm is spurious. Let's add `-f' to
that rm(1) so it doesn't confuse us when debugging an install.

MFC after:	3 days
2013-12-18 21:16:57 +00:00
Devin Teske
31a0cf130a Fix "[: -eq: argument expected" error introduced by SVN r256343. The code
should not have used DIALOG_CANCEL because dialog.subr wasn't included to
define it. The effect of the error was that you could not cancel the
partition dialog. Discovered by checking bsdinstall_log for something else.

MFC after:	3 days
2013-12-18 21:13:50 +00:00
Devin Teske
926ec73fe2 Auto-enable 4k sector alignment when disk encryption is requested (it is
required in such a case). But don't prevent the user from pointing the
gun at his/her foot -- you can disable 4k alignment after enabling geli).

MFC after:	3 days
2013-12-16 19:54:55 +00:00
Devin Teske
cf9c3e5697 Fix a long-standing edge-case that would result in a ghosted `zroot' pool
and subsequent headaches caused by multiple pools with the same name.
Specifically, blast away any labels on the designated swap partition.
Problem was when you install to a given layout *with* swap and then turn
around and re-install the same layout *without* swap (we weren't doing a
labelclear for the swap device, so would end up with an "UNAVAIL" status
zroot pool that may only exist in the pool cache).

MFC after:	3 days
2013-12-16 19:51:11 +00:00
Devin Teske
ee482f2c28 Add kern.geom.label.disk_ident.enable="0" to loader.conf(5).
Discussed on:	-current, -stable
MFC after:	3 days
2013-12-16 19:47:04 +00:00
Devin Teske
7a434c5cc7 De-uglify the geli(8)-setup infobox by adding a newline.
MFC after:	3 days
2013-12-16 19:44:45 +00:00
Devin Teske
ca2d97c2c8 fletcher4 is currently the default.
Discussed on:	-current
MFC after:	3 days
2013-12-16 19:43:04 +00:00
Devin Teske
7cae6aab5b Improve default ZFS disk layout (tested):
+ For GPT, always provision zfs# partition after swap [for resizability]
+ For MBR, always use a boot pool to relialy place root vdevs at EOD
NB: Fixes edge-cases where MBR combination failed boot (e.g. swap-less)
+ Generalize boot pool logic so it can be used for any scheme (namely MBR)
+ Update existing comments and some whitespace fixes
+ Change some variable names to make reading/debugging the code easier
  in zfs_create_boot() (namely prepend zroot_ or bootpool_ to property)
+ Because zroot vdevs are at EOD, no longer need to calculate partsize
  (vdev consumes remaining space after allocating swap)
+ Optimize processing of disks -- no reason to loop over the disks 3-4
  separate times when we can logically use a single loop to do everything

Discussed on:	-stable
MFC after:	3 days
2013-12-16 19:37:15 +00:00
Devin Teske
a622223f01 Bug-fixes and debugging improvments:
+ De-obfuscate debugging to show actual values
+ Change graid(8) syntax; s/destroy/delete/ [destroy is not invalid syntax]
+ Log commands that were previously quiet
+ Added some new comemnts and updated some existing ones
+ Add missing local for `disk' used in zfs_create_boot()
+ Use $disks instead of multiply-expanding $* in zfs_create_boot()
+ Pedantically unset variable holding geli(8) passphrase after use
+ Pedantically add double-quotes around zpool names and zfs datasets
+ Fix quotation expansion for zpool_cache entries of loader.conf(5)
+ Some limited whitespace changes

MFC after:	3 days
2013-12-16 18:53:09 +00:00
Devin Teske
30c8ebe9b7 Accept NULL input as also meaning zero swap.
MFC after:	3 days
2013-12-16 17:11:09 +00:00
Devin Teske
a6c8532c17 As per discussions on -current, re-add /var/mail (removed in r257842) but
this time with atime=on in support of various software that requires it.

Discussed on:	-current
MFC after:	3 days
2013-12-16 17:03:44 +00:00
Devin Teske
a7fb3c62e7 Mask error from newaliases(1) when the hostname is not fully qualified.
MFC after:	3 days
2013-12-16 15:52:44 +00:00
Devin Teske
d25257776a Add a fix for Long-standing problem with VMware. Described in below links:
https://communities.vmware.com/thread/107230
https://communities.vmware.com/docs/DOC-11677

Basically, ignore the ``function 62'' and ``function 63'' interpretations
of the left/right command key when we're in the lengthiest portion of the
installation (initiated by the `auto' module).

The net effect is that you can now (once you've started the installer from
the media) escape the VM without prematurely terminating the current action
due to spurious escape sequence.

MFC after:	3 days
2013-12-16 15:50:59 +00:00