summaryrefslogtreecommitdiff
path: root/distrib/miniroot/install.sub
AgeCommit message (Collapse)Author
2024-07-09Removing 'softdep' options from fstab entries during upgrade is no longerKenneth R Westerback
necessary as 'softdep' is now a no-op. ok beck@ sthen@
2024-06-15Install BUILDINFO if available.Florian Obser
We already keep /var/db/installed.SHA256 for sysupgrade(8) as a cheap check to not install the same snapshot over and over again. With /mnt/var/db/installed.BUILDINFO we can ensure that we are not installing an older snapshot over a newer snapshot. Intentionally not yet committing the sysupgrade(8) bits so that we exercise the sysupgrade(8) / install.sub interaction as it will happen during the 7.5 -> 7.6 transition. I.e. a newer install.sub getting installed by an older sysupgrade(8). deraadt@ likes it.
2024-05-12Rerun installboot(8) after fw_update(8) to pick up Apple boot firmwareKlemens Nanni
Firmware is fetched after bootstraps are installed, i.e. on fresh installs apple-boot is not there yet when installboot ought to place it onto the EFI System Partition. Rerun --only on Apple silicon-- to replace Asahi u-boot and boot straight into ours, nicely visible my different logo. Input sthen deraadt
2024-03-15Backout "Move code into new stop_watchdog()"Klemens Nanni
An upgrade stalled on me, either my testing was flawed or my diff is... Having stop_watchdog() is fine, but calling it in a different place has is apparently too subtle for me to get right.
2024-03-15Move code into new stop_watchdog()Klemens Nanni
We have {reset,start}_watchdog() which are only used in unattended upgrade code, but stopping the background timer is done inline for all upgrades, incl. interactive ones. Relocate it out of the very end of do_upgrade() right after its only caller and limit it to unattended upgrades to match where/how the timer is started. OK afresh1
2024-03-05prune clang13 libLLVM; OK sthenKlemens Nanni
2024-02-19Avoid passphrase in temporary fileKlemens Nanni
bioctl(8) uses readpassphrase(3) RPP_REQUITE_TTY, so always pass stdin, but only use it over TTY with -s in unattended mode. Prodding afresh1 sthen "much better" sthen
2024-02-11Enable disk encryption in unattended installationsKlemens Nanni
Interactively keeps using bioctl(8)'s own prompt, in unattended mode ask_passphrase() ensures non-empty responses or fails. Unlike user passwords, autoinstall(8) only supports plaintext passphrases: Encrypt the root disk with a (p)assphrase or (k)eydisk = passphrase New passphrase = secret Make sure to trust the install network or use a pre-configured key disk: Encrypt the root disk with a (p)assphrase or (k)eydisk = keydisk Which disk contains the key disk = sd2 Which sd2 partition is the key disk = a initial diff from Chris Narkiewicz OK afresh1 Feedback sthen
2024-01-26remove /mnt/usr/include/c++/v1 before extracting sets, it changed fromStuart Henderson
a file to a dir with the libc++ update to 16. ok deraadt phessler
2023-10-24add fallback IPv6 address for ftplist1.openbsd.org; ok phessler@Christian Weisgerber
2023-10-19Support encrypting the root disk with a key diskKlemens Nanni
Extend the yes/no question to no/passphrase/keydisk and have users pick an existing, preformated RAID partition; no support (yet) for creating one. OK tb afresh1
2023-08-21No need to make_dev() existing root device in disk crypto questionKlemens Nanni
Since r1.1245 encrypt_root() happens immediately after get_rootinfo(). the latter creates device files for the root disk (and aborts if make_dev() fails), so encrypt_root()'s call on the softraid chunk is purely redundant. Hoist _chunk definition into declaration while here.
2023-08-21Remove retry loop crutch around disk passphrase promptKlemens Nanni
bioctl(8) now retries itself on mismatch so the installer continues until the passphrase is confirmed correctly (like for the root password) instead of bailing out after three failed attempts.
2023-08-10Always create new softraid CRYPTO volume, do not reuse existing oneKlemens Nanni
The bioctl(8) command to create new and unlock old volumes is the same. Use `-C force' to prevent reuse, which happens with, e.g. aborted/restarted encrypted installations past the question or installations onto an old disk. OK naddy sthen deraadt
2023-08-02Simplify disk encryption questionKlemens Nanni
The yes/no question was mistaken as actual passphrase prompt and/or details in parentheses were taken as option list (despite the lack of commas). Unmention the only disk encryption mechanism we support and simply ask whether to protect the root disk with a passphrase or not (still yes/no). Prodded by solene, feedback from many Wording from naddy, similar wording from sthen OK naddy sthen deraadt afresh1
2023-07-08Floppies don't have bioctl(8)Klemens Nanni
The installer always checks for softraid using it, skip if unavailable. Apply the usual idiom in encrypt_root() to silence stderr noise. Do so in do in get_softraid_chunks() as well which is always called in get_dkdevs_unitialized() and finish_up(); get_softraid_chunks() discards stderr and both users still do the right thing on bioctl failure/empty output from get_dkdevs_unitialized(), but there's no point in trying plus the idiom clarifies how this code is indeed used on floppies. Found and tested by krw OK deraadt krw
2023-06-18accept 'a' as shortcut for 'autoconf'; ok op afresh1 knTheo de Raadt
2023-06-06Fold disk crypto question '?' text into promptKlemens Nanni
Since this question moved after the root disk one and '?' stopped listing disks, hoist the implementation details in order to drop the custom answer and reuse existing ask_yn(), thus Encrypt the root disk? (yes, no or '?' for details) [no] ? Create a passphrase protected CRYPTO softraid volume to be used as root disk. Encrypt the root disk? (yes, no or '?' for details) [no] becomes Encrypt the root disk? (passphrase CRYPTO softraid) [no] Prodded by afresh1
2023-05-24replace "$(cat file)" with the ksh construct "$(<file)"Christian Weisgerber
ok kn@ millert@
2023-05-22Drop unused md_prep_fdisk() argument in disk crypto question handlerKlemens Nanni
It takes just one, the disk; the second snuck from earlier development into the intial r1.1231 commit.
2023-05-20typofix message in previousKlemens Nanni
2023-05-20Ask for disk crypto after root disk questionKlemens Nanni
Encrypt the root disk? (disk, no or '?' for details) [no] Which disk is the root disk? ('?' for details) [sdN] becomes Which disk is the root disk? ('?' for details) [sd0] Encrypt the root disk? (yes, no or '?' for details) [no] so that answering 'sd0' at this point during installation behaves the same as before the new question: specifying the root disk. Users no longer deal with two (softraid chunk sd0, root disk sd1), but just one disk as before, while sdN are dealt with transparently. Code also gets simpler and should enable more improvements soon. Feedback OK afresh1
2023-05-02Absolutely astounding that custom code was written for the softraid caseTheo de Raadt
to require "no", instead of "n" or "no" which works at every other damn prompt in the installer. This seems to be an artifact of relentlessly pushing people towards softraid by default, and I think that is a bit nasty and pushy.
2023-04-25drop empty lines around disk crypto '?' help textKlemens Nanni
2023-04-17Indent interface and disk listingsKlemens Nanni
'?' output to list available answers could better distuingish from questions and other lines, like sets selection does with four leading spaces. OK deraadt
2023-04-07Default 'Is the disk partition alrady mounted?' to 'no' on installKlemens Nanni
For installation, no partitions whatsoever are mounted, so 'yes' is always wrong unless the user manually mounted stuff before that question. No change for upgrade, where partitions on the root disk are mounted. Idea from naddy, diff from Mikhail (mp39590 AT gmail) Tweaks from me OK op afresh1
2023-04-07Nail the root disk default in the guided disk encryption caseKlemens Nanni
Save the softraid volume's device and make it root disk default, being the only legit choice in this case; this gets it always right on systems with multiple physical disks. All other install/upgrade cases keep picking the first available [sw]d* disk as root disk default. OK afresh1
2023-04-02Rename get_softraid_{disks -> chunk}() and CRYPTO{DISK -> CHUNK}Klemens Nanni
"disk" can mean both "chunk" and "volume" and a future diff for better softraid volumes handling will benefit from this distinction. No functional change.
2023-04-01Limit IFS scope to effect parsing code onlyKlemens Nanni
Set to split `hw.disknames' strings is neat, but functionn-wide means the bsort() invocation honours it, i.e. it'll output newlines not spaces. Break the one-liner into the same multi-line idom occuring elsewhere and contain IFS in the subshell that needs it. This was never visible due how the output of was consumed by the shell. The only visual, but otherwise effectless bug due to this appeared with the new disk encryption question double-quoting get_dkdevs() output, i.e. multiple disks printed across multiple lines; this yields one, as inteded. OK afresh1
2023-03-29Quote possible 'none' answer as part of help text after questionKlemens Nanni
'Default IPv4 route?' takes an IP or this word, not no IP at all. All other questions already quote their 'none', 'done', etc. answers. No behaviour change for autoinstall(8) files, questions end after the qestion mark and potential answers/help in parentheses comes after that.
2023-03-27Revert r1.1235, "simplify final MAKEDEV call"Theo Buehler
While MAKEDEV accepts multiple args, it complains loudly on repeated args. It is silent when trying to create a single already existing device. This is probably a bug in MAKEDEV.
2023-03-25simplify final MAKEDEV callKlemens Nanni
No need to loop here, the script takes multiple args. OK tb afresh1
2023-03-10Fix error on installer abort/exitKlemens Nanni
^C during questiong yields /install: /tmp/cppid: cannot open $(<) input The trap handler must first test existence, then read the PID file. Quote like other PID file constructs in install.sub do. Use newlines to make the trap function readable. OK miod
2023-03-09remove obsolete libLLVM.so.[0-6].0 during upgradeChristian Weisgerber
ok kn@ deraadt@
2023-03-08Treat WEP like WPA: only offer if supportedKlemens Nanni
WEP does not work with our bwfm(4) and it shows: Which network interface do you wish to configure? (or 'done') [bse0] bwfm0 ifconfig: SIOCS80211NWKEY: Operation not supported by device Access point? (ESSID, 'any', list# or '?') [any] 2 Security protocol? (O)pen, (W)EP, WPA-(P)SK [O] Handle the error and disable (W)EP unless the driver has it. No objections from anyone.
2023-03-07Initial support for guided disk encryptionKlemens Nanni
One new question to cover the most common use case, such that manual setup in (S)hell or '!' prior to install is no longer required: Encrypt the root disk? (disk, 'no' or '?' for details) [no] ? Create a passphrase protected CRYPTO softraid volume to be used as root disk. Available disks are: sd0. Encrypt the root disk? (disk, 'no' or '?' for details) [no] Use of keydisk or different disciplines are not covered. Only asked in interactive installations; no autoinstall(8) or upgrades. Only reachable on i386, amd64, sparc64 and riscv64 for now (arm64 WIP). Tested by cheloha naddy and a few users Feedback from cheloha deraadt claudio OK cheloha "get it in now" deraadt
2023-02-21Have disk and string list helpers print trailing newlins consistentlyKlemens Nanni
In practise, omitting \n is pointless in get_*devs*(), addel() and rmel() as they are all all used in such a way that the shell always ensures a trailing \n anyway. (This might have been needed with the old recursive bsort(), but not now.) The one exception being the case of a ramdisk with no disks, which revealed \n mishandling in the root disk question where it ought to print "none" instead of an empty list of available disks (since inception in r1.1114): Available disks are: . Which disk is the root disk? ('?' for details) ? OK afresh1
2023-02-19Improve media disk question defaultKlemens Nanni
Sets on an unmounted disk partition are most likely to be on install media, e.g. CD or USB stick. Default 'Which disk contains the install media?' to the first disk that is a) not the root disk and b) not a disk with softraid chunks (hosting the root disk, for example). This makes it point at the right disk in most setups. All disks remain valid answers, this is only about the default. OK afresh1
2023-02-16Rewrite bsort() from hand-rolled recursive to simpler iterative reusing codeKlemens Nanni
ksh(1) can sort itself and addel() ensures uniqueness, so reuse both to get a much simpler shell version of `sort -u' that is bug-for-bug compatible with the old one but shorter and easier to tweak/reason about. OK afresh1
2023-02-09Do not ask to initialize disks with softraid chunksKlemens Nanni
Skip chunk devices in the 'Which disk do you wish to initialize?' question. Touching sd0, e.g. after a root on softraid sd1 install on sd0, will fail. get_dkdevs_uninitialized() is used once, in interactive installs, right after root disk setup, iff multiple disks exist. Tested as part of a bigger diff by a few OK cheloha
2023-02-03Define get_softraid_disks() before get_dkdevs*() so they can use itKlemens Nanni
2023-02-03Make softraid helper return disk not device namesKlemens Nanni
get_softraid_chunks() yields full device names with labels, e.g. "sd0a", but the installer largely deals with disk names "sd0". The only user of this, MAKEDEV, behaves identically with either form. Rename to get_softraid_disks(), clarify comments and return disk names so it can be reused without pattern matching or stripping labels. OK afresh1
2023-02-02Move existing softraid check into reusable functionKlemens Nanni
No behaviour change, but get_softraid_chunks() reads much clearer. The root disk is checked to be a softraid volume; if so, devices for each chunks are created to make installboot work later. bioctl accepts "sd1" and "softraid0", the latter prints all volumes. Output is identical if sd1 is the only volume. OK afresh1
2023-01-28create enough wskbd* device nodes at runtime in the ramdisk so we can setPeter Hessler
the keyboard layout on all of them during install. tested with a Thinkpad X13s with a silly amount of kezboards connected. OK miod@ kn@
2023-01-18Typofix array length syntax, spotted by afresh1Klemens Nanni
2023-01-17Add debug FUNCS_ONLY knobKlemens Nanni
Hacking on the installer while running it is a lot easier when you can inspect or run functions directly without paging the whole script or poking around in it with ed. install.sub is already structured so that all functions come first, then MD code, then actual commands. Copy FUNCS_ONLY from rc.subr(8) so you can drop out any time and hack around more conveniently: Available disks are: sd0 sd1. Which disk is the root disk? ('?' for details) [sd0] ! Type 'exit' to return to install. test# FUNCS_ONLY=1 . /install.sub test# typeset -f get_dkdevs get_dkdevs() { echo $(scan_disknames "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}") } test# get_dkdevs sd0 sd1 test# This requires the sourcing shell to be ksh(1) or sh(1) with 'strict Bourne shell mode' disabled. '!' is ksh now, but the initial (S)hell answer still lands in a strict (default) sh(1) -- that can/should be fixed separately. OK deraadt
2023-01-17Skip all interface config questions when there are noneKlemens Nanni
Even without any interfaces the installer still asks for one and only continues when the only possible answer 'done' is provided. That means one mandatory but useless answer during installations like # vmctl start -c -d ./install72.img -d ./disk.img test ... System hostname? (short form, e.g. 'foo') test Available network interfaces are: . Network interface to configure? (name, lladdr, '?', or 'done') A response is required. Network interface to configure? (name, lladdr, '?', or 'done') ? Available network interfaces are: . Network interface to configure? (name, lladdr, '?', or 'done') done DNS domain name? (e.g. 'example.com') [my.domain] ... Skip it when there is no viable answer: # vmctl start -c -d ./install72.img -d ./disk.img test ... System hostname? (short form, e.g. 'foo') test DNS domain name? (e.g. 'example.com') [my.domain] ... OK deraadt
2023-01-12On '!', drop into a proper ksh(1) instead of a limited sh(1) lackingKlemens Nanni
arithmetic expression `(( ... ))' and more. OK deraadt
2022-12-23Allow configuring interfaces by lladdr in installerAndrew Fresh
This modifies the installer question, auto install scripts may need updating. Allows answering ? to the interface question to list allowed lladdrs and allows answering with one of them to configure the interface. Reconfiguring by either name/unit or lladdr will clear the previous config. Many suggestions from kn@ finish it @deraadt
2022-12-16drop a total of 93 trailing spaces from three linesTheo Buehler