History log of /netbsd-current/usr.sbin/sysinst/defs.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.92 22-Apr-2024 nia

Move MIPS N64 compat out of {base,debug}32 into {base,debug}64

martin requested separation by ABI and it doesn't make much sense
to have 64-bit binaries in a set called 32.


# 1.91 09-Apr-2024 nia

Add new sets: base32, debug32, manhtml

- base32 contains (when MKCOMPAT=yes) shared libraries for 32-bit
compatibility, previously included in base

- debug32 contains (when MKCOMPAT=yes) debug symbols and static libraries
containing debug symbols for 32-bit compatiblity, previously included
in debug

- manhtml contains (when MKHTML=yes) the HTML files previously included
in 'man', which are of limited utility without third-party software.

The motivation for this change is to be able to easily exclude sets
from CD-ROM images that go over the size limit without xz compression
(which many NetBSD platforms struggle to extract at acceptable speeds).


# 1.90 17-Dec-2023 martin

Add a https transfer method (sharing all host details with the http
transfer). Make this method the default for all downloads.

Try to make sure the binary pkg installation (which runs in a chroot
in the already installed system) can make use of SSL verification.

This does NOT fix the missing SSL verification in most install media
even if using https (due to not fully populated /etc/openssl/certs).


# 1.89 14-Mar-2023 kre

Correct a minor word usage error in a comment. NFC.


Revision tags: netbsd-10-0-RC1 netbsd-10-base
# 1.88 15-Dec-2022 martin

branches: 1.88.2;
Add an (expert) option to manually edit partitions, inspired by PR 57100.


# 1.87 11-Jul-2022 martin

Avoid C++-isms (stupid muscle memory) to fix the build.


# 1.86 10-Jul-2022 martin

Preparations to make the extended partitioning during normal installation
more usefull - pass an optional install_description to partman().


# 1.85 24-Jun-2022 tsutsui

Check on-disk disklabel properly even on ports without raw BSD disklabel.

Fixes PR install/56890.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.91 09-Apr-2024 nia

Add new sets: base32, debug32, manhtml

- base32 contains (when MKCOMPAT=yes) shared libraries for 32-bit
compatibility, previously included in base

- debug32 contains (when MKCOMPAT=yes) debug symbols and static libraries
containing debug symbols for 32-bit compatiblity, previously included
in debug

- manhtml contains (when MKHTML=yes) the HTML files previously included
in 'man', which are of limited utility without third-party software.

The motivation for this change is to be able to easily exclude sets
from CD-ROM images that go over the size limit without xz compression
(which many NetBSD platforms struggle to extract at acceptable speeds).


# 1.90 17-Dec-2023 martin

Add a https transfer method (sharing all host details with the http
transfer). Make this method the default for all downloads.

Try to make sure the binary pkg installation (which runs in a chroot
in the already installed system) can make use of SSL verification.

This does NOT fix the missing SSL verification in most install media
even if using https (due to not fully populated /etc/openssl/certs).


# 1.89 14-Mar-2023 kre

Correct a minor word usage error in a comment. NFC.


Revision tags: netbsd-10-0-RC1 netbsd-10-base
# 1.88 15-Dec-2022 martin

branches: 1.88.2;
Add an (expert) option to manually edit partitions, inspired by PR 57100.


# 1.87 11-Jul-2022 martin

Avoid C++-isms (stupid muscle memory) to fix the build.


# 1.86 10-Jul-2022 martin

Preparations to make the extended partitioning during normal installation
more usefull - pass an optional install_description to partman().


# 1.85 24-Jun-2022 tsutsui

Check on-disk disklabel properly even on ports without raw BSD disklabel.

Fixes PR install/56890.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.90 17-Dec-2023 martin

Add a https transfer method (sharing all host details with the http
transfer). Make this method the default for all downloads.

Try to make sure the binary pkg installation (which runs in a chroot
in the already installed system) can make use of SSL verification.

This does NOT fix the missing SSL verification in most install media
even if using https (due to not fully populated /etc/openssl/certs).


# 1.89 14-Mar-2023 kre

Correct a minor word usage error in a comment. NFC.


Revision tags: netbsd-10-0-RC1 netbsd-10-base
# 1.88 15-Dec-2022 martin

Add an (expert) option to manually edit partitions, inspired by PR 57100.


# 1.87 11-Jul-2022 martin

Avoid C++-isms (stupid muscle memory) to fix the build.


# 1.86 10-Jul-2022 martin

Preparations to make the extended partitioning during normal installation
more usefull - pass an optional install_description to partman().


# 1.85 24-Jun-2022 tsutsui

Check on-disk disklabel properly even on ports without raw BSD disklabel.

Fixes PR install/56890.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.89 14-Mar-2023 kre

Correct a minor word usage error in a comment. NFC.


Revision tags: netbsd-10-base
# 1.88 15-Dec-2022 martin

Add an (expert) option to manually edit partitions, inspired by PR 57100.


# 1.87 11-Jul-2022 martin

Avoid C++-isms (stupid muscle memory) to fix the build.


# 1.86 10-Jul-2022 martin

Preparations to make the extended partitioning during normal installation
more usefull - pass an optional install_description to partman().


# 1.85 24-Jun-2022 tsutsui

Check on-disk disklabel properly even on ports without raw BSD disklabel.

Fixes PR install/56890.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


Revision tags: netbsd-10-base
# 1.88 15-Dec-2022 martin

Add an (expert) option to manually edit partitions, inspired by PR 57100.


# 1.87 11-Jul-2022 martin

Avoid C++-isms (stupid muscle memory) to fix the build.


# 1.86 10-Jul-2022 martin

Preparations to make the extended partitioning during normal installation
more usefull - pass an optional install_description to partman().


# 1.85 24-Jun-2022 tsutsui

Check on-disk disklabel properly even on ports without raw BSD disklabel.

Fixes PR install/56890.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.87 11-Jul-2022 martin

Avoid C++-isms (stupid muscle memory) to fix the build.


# 1.86 10-Jul-2022 martin

Preparations to make the extended partitioning during normal installation
more usefull - pass an optional install_description to partman().


# 1.85 24-Jun-2022 tsutsui

Check on-disk disklabel properly even on ports without raw BSD disklabel.

Fixes PR install/56890.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.85 24-Jun-2022 tsutsui

Check on-disk disklabel properly even on ports without raw BSD disklabel.

Fixes PR install/56890.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.84 19-Jun-2022 martin

Centralize the "we can newfs this type of filesystem" predicate
and fix the list.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.83 22-May-2022 andvar

fix various small typos, mainly in comments.


# 1.82 18-May-2022 martin

When not invoked via some explicit "configure network" menu item,
auto-detect an already working network setup and offer to "just use" it
whenver we need connectivity.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.81 21-Apr-2022 martin

Make default installations a bit more secure:
- push a bit harder for setup of a root password
- simplify/clarify manual entropy setup
- visit the entropy setup (on machines where it is needed) on the
default path through sysinst


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.80 10-Feb-2022 martin

x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.79 30-Jan-2022 martin

Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.


# 1.78 29-Jan-2022 martin

When upgrading, update the boot code post extraction from
the updated target file system.


# 1.77 29-Jan-2022 martin

Try to get rid of all wedges we created (after unmounting).


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.76 05-Dec-2021 msaitoh

s/exisit/exist/ in comment.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.75 08-Oct-2021 martin

Re-enable the entropy handling code in sysinst (only visible on machines
that do not have full entropy), but move it to the config menu
instead of enforcing it as mandatory step.

This menu is shown at the end of the setup, or if explicitly invoked
from the main menu.

Some of the input options are complex but useful in some situations
and code to support them is tiny. Most users will use the manual input
(first + default option) but some might prefer to connect a USB TRNG
or have easy setups to transfer entropy from another machine (while
copy & paste on a serial console sometimes is tricky).


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.74 26-Sep-2021 maya

Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional

Simplifies logic.
(Second commit - first one was partial)

Restoring MK* requested by mrg on tech-kern discussion
https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.73 25-Sep-2021 maya

Move DRM-driver firmware from base to its own set, gpufw

This set is only installed on amd64,i386,evbarm.
This set is installed on minimal installs and on install media, in
case someone needs it for basic driver functionality.

Comments:
Switched to a single MK tunable for it - that is probably unneeded.

An upcoming DRM update will include even fatter firmware, and we'd
like to minimize the impact of it.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.72 12-Aug-2021 martin

PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.71 13-Jul-2021 martin

PR install/56303: when using xz files enable swap during set extraction
if the machine does not have more than 256MB of RAM.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.70 31-Jan-2021 rillig

sysinst: remove trailing whitespace from *.c *.h

In contrast to the messages files, this whitespace is not significant.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.69 04-Nov-2020 martin

Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.68 30-Oct-2020 martin

PR 55769: avoid the module set if we do not build any


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.67 13-Oct-2020 martin

PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.


# 1.66 12-Oct-2020 martin

PR 55536: when we find existing partition tables and have alternative
formats available, offer to delete partitions and create new ones from
scratch (in some other or the same on-disk format).


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.65 09-Oct-2020 martin

When MD code requests a reserved area (at the start of the disk)
make sure to properly account for the "lost" space during all calculations
and especially when expanding the main partition to fill the disk.

Avoid using the global "pm" or a passed device descriptons when we are
passing disk limits explicitly anyway.

Simplify/fix a few rounding calculations.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.64 29-Sep-2020 martin

PR 55381: try to deal with moved (but not yet saved) partitions when
calculating free space


# 1.63 22-Sep-2020 martin

Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.62 18-May-2020 jmcneill

Separate devicetree .dts -> .dtb building from kernel builds. They are now
part of a separate set, "dtb.tgz", and only built when MKDTB=yes. This
defaults to yes for earmv[67]* and aarch64, and no everywhere else.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.61 12-May-2020 martin

PR 55202: disable swapping if we started it due to low ram


# 1.60 12-May-2020 martin

Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.


# 1.59 12-May-2020 martin

At the end of a new installation save entropy.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.58 22-Apr-2020 joerg

Don't depend on common symbol definitions.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


Revision tags: is-mlppp-base
# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.57 16-Mar-2020 martin

PR misc/54886: bump threshold for automatic/default creation of a tmpfs /tmp
up slightly (to 384 MB ram). This will make sure the default install has
a > 64 MB /tmp available (number pulled out of thin air, 64 MB is the minimum
required by the ZFS tests).


# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.56 19-Feb-2020 martin

Remove unused "rel" global variable and make the -r option a no-op.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.55 10-Feb-2020 martin

Do not use -P for tar extractions - the in tree tar has been fixed.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.54 27-Jan-2020 martin

Fix support for non-512-byte/sector disks again after I broke it when
introducing the abstract partition backends.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.53 24-Jan-2020 martin

Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.52 20-Jan-2020 martin

First try to bring evbarm installation closer to current reality.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.51 16-Jan-2020 martin

Fix /tmp tmpfs handling and on machines with enough RAM default to
creating a /tmp tmpfs with 25% of ram size limit. Suggested by ad@.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.50 09-Jan-2020 martin

Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.49 11-Dec-2019 martin

Get rid of the evbarm preliminary menu: do not bother to ask the user
whether this is a RPi - query the FDT instead.


Revision tags: phil-wifi-20191119
# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.48 14-Nov-2019 martin

Make tar extraction flags depend on our usage of pax-as-tar or bsdtar.


# 1.47 13-Nov-2019 martin

Make cloning support optional, so we can save some space on very small
install media.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.46 12-Nov-2019 martin

Add options to the various partitioning stages that allow cloning of
alien partitions (optionally including data).


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.45 02-Oct-2019 maya

Split out /rescue to its own set and adapt installers/images to add it.

This is meant to make updates safer: if something goes wrong with updating
base, we still have the old, standalone /rescue to recover from.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.44 27-Aug-2019 martin

Do not offer to upgared the "current system" if we are running off a CD
(i.e. / is mounted read-only)


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.43 07-Aug-2019 martin

Support upgrade of systems using NAME= syntax in /etc/fstab.

Make supported file system types dynamic - instead of hardcoding the
available types at compile time, check for available newfs_* helper
binaries in the actual install environment at runtime.


Revision tags: netbsd-9-base
# 1.42 26-Jul-2019 martin

branches: 1.42.2;
Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.42 26-Jul-2019 martin

Strip trailing / from last mounted strings.
No idea how they happen, but for cgd root (init.root = "/altroot")
they have been reported to exist.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.41 23-Jul-2019 martin

For upgrade / re-install allow the currently running system as a target
in the "disk" selection.


# 1.40 23-Jul-2019 martin

Fix the "reinstall sets" action.


# 1.39 23-Jul-2019 martin

When searching for a partition that may be the root partition for upgrading,
allow "/", "/targetroot" and "/altroot" as potential last mount points.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.38 13-Jul-2019 martin

We may call md_pre_mount() multiple times for the same install set,
so pass an additional index argument so MD code knows which part
of the install will be mounted next.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.37 12-Jul-2019 martin

When adding non-disklabel boot partitions (or similar), distinguish between
ones we need to add to the outer (MBR) partitions, or copy over to the
inner (disklabel) partitions.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.36 21-Jun-2019 christos

refactor disk ioctl stuff to make it smaller.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.35 20-Jun-2019 christos

add more printflikes() (rin) and remove unused function.
cVS: ----------------------------------------------------------------------


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.34 12-Jun-2019 martin

Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.

Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.

Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:

- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".

- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)

- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".

- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)

Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.

This work was sponsored by The NetBSD Foundation, Inc.


Revision tags: phil-wifi-20190609
# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

branches: 1.11.2;
Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.


# 1.33 12-Feb-2019 martin

Backout previous snprintf nonsense, instead STFU gcc 7's most
useless warning ever.


# 1.32 11-Feb-2019 martin

Fix a few off by one (in both directions) in previous, pointed out by mrg.
Avoid open coding snprintf return value checking and introduce a
helper functions that always ensures string termination instead,
suggested by christos.


# 1.31 27-Jan-2019 oster

Remove extra #ifdef and duplicated set of #ifdef's.


# 1.30 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.29 16-Dec-2018 martin

Separate binary sets and binary pkg prefix from the machine, and set
it explicitly for evbarm*, evbmips* and evbsh3 so we get the correct
64bit pkgs on aarch64 and also have working defaults on the other
variants.


# 1.28 27-Nov-2018 martin

Cosmetics: consistently use MEG and GIG defines for size calculations


Revision tags: pgoyette-compat-1126
# 1.27 19-Nov-2018 martin

Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


# 1.26 15-Nov-2018 martin

Add a new helper function to show messages with positional parameters


# 1.25 14-Nov-2018 martin

Slightly enhance previous: create two utility functions checking for
partitionability and boot code requirements, use a generic match helper
function for both and fully check the device name.


# 1.24 11-Nov-2018 martin

Skip floopies when selecting an install target, but do not add them to
the CD list when selecting an installation source device.


# 1.23 11-Nov-2018 martin

Do not allow installation onto floppy disk - can be overriden by
architectures where it would make sense (none currently), and also
works around a bug in QEMU for sparc that kills our -current anita tests.


# 1.22 08-Nov-2018 martin

Adapt other cd-device query functions to new world order, fix
default cd device (assume 'a' partition).


# 1.21 07-Nov-2018 martin

Unify handling of CDROM device names.
Skip CDs when looking for install targets (we do not support installing
onto a blueray with UDF).

Fix search for the default CDROM device and the CD we booted from
for ports with nonstandard CDROM device names.


Revision tags: pgoyette-compat-1020
# 1.20 06-Oct-2018 martin

Support sets in .tar.xz format


Revision tags: pgoyette-compat-0930
# 1.19 20-Sep-2018 rin

Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos


# 1.18 16-Sep-2018 martin

Now that the build cluster creates stable "latest" links, use them
as default for downloading sets.


# 1.17 12-Sep-2018 martin

Try to properly guess a path on the ftp server for pkg binaries
and use that as default.

Assume for $N.99 (current) we can use $N.0. Otherwise strip all
RC*/STABLE* annotations and just use the plain numbers.


# 1.16 11-Sep-2018 martin

Split the host name used for ftp transfers from the one used for http
transfers. This is slightly inconsistent, as directories are still
shared - but this allows us to default to cdn/nycdn for http (which don't
support ftp).


# 1.15 08-Sep-2018 martin

Fix editor accident in previous


# 1.14 06-Sep-2018 martin

Fix previous in case when BUILDID is passed - the subdirectory has the
same name as the BUILDID (which already includes the trailing "Z", no need
to append it again)


Revision tags: pgoyette-compat-0906
# 1.13 05-Sep-2018 martin

For local builds, at least use the right prefix on nyftp


# 1.12 05-Sep-2018 martin

Try to guess the proper directory on ftp or nyftp where the binary
sets for the current build will end up.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.11 03-Jun-2018 martin

Add an option to install onto a pre-configured wedge.
Greatly simmplifies (U)EFI setups (but does not fully automate them yet).


Revision tags: pgoyette-compat-0521
# 1.10 18-May-2018 joerg

deconst -> __UNCONST, the former involves UB with NULL arithmetic.


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.9 11-May-2015 martin

branches: 1.9.8; 1.9.14;
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.


# 1.8 10-May-2015 martin

Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.


# 1.7 09-May-2015 martin

Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.


# 1.6 02-Jan-2015 abs

Rather than scatter set_swap() calls wrapped in ram size checks through
md_post_disklabel() and md_pre_update(), abstract them out to an MI
set_swap_if_low_ram() and call from the appropriate MI places.
Now all platforms add swap if the system has <= 32M of RAM.


# 1.5 14-Oct-2014 christos

Don't use asctime(localtime(time_t *)) because this is really ctime(time_t *)
and not checking the result of localtime can lead to tears.
Add a safectime() that always returns a good string, and add some debugging
so that we can see if there is indeed something wrong in the new libc time
code.


# 1.4 13-Sep-2014 roy

Only prompt for one nameserver, let the user decide if it's a
pre-determined google server other another one.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.3 06-Aug-2014 martin

branches: 1.3.2; 1.3.4; 1.3.6;
Remove a few menu entries if raid/lvm/cgd/gpt are not available.


# 1.2 03-Aug-2014 martin

(Finally) merge a slightly modified version of the 2012 GSoC results
from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.


# 1.1 26-Jul-2014 dholland

Move sysinst sources to usr.sbin.

This commit only physically moves the sources - there are no other
changes, to maximize the probability that this will be treated as a
rename if we ever do manage to migrate away from CVS.

Moving sysinst has been discussed on and off for years and has two
goals: making it easier to work on sysinst, and also making sysinst
available on running systems for use installing chroots and VM images
and other such things. None of the latter is possible yet, but as they
say, one thing at a time.

Doing this now was approved in an impromptu fashion by mrg, riz,
riastradh, me, and groo.