Commit Graph

545 Commits

Author SHA1 Message Date
Lyndon Brown c534ff52a4 defaults: ensure labels have defaults for derivatives 2020-03-20 10:19:33 +00:00
Lyndon Brown 2c14566c69 defaults: tidy mirrors 2020-03-20 10:19:33 +00:00
Lyndon Brown 945a166f75 strip progress-linux distro hacks
progress-linux, as discussed in MR #142 ([1]) is a little known distro,
which appears to be little more than a personal project of the original
author of live-build.

given that, the expense of maintaining all of these old hacks for it
cannot be justified. it is not known whether or not live-build is even
used with respect to it since the author abandoned live-build some
years ago.

also, at least one past change in live-build possibly broke progress-linux
compatibility anyway, which would have required progress-linux users of
live-build to use a custom progress-linux config, or a progress-linux
fork of live-build, and there is no knowing how much of the hacks in this
"upstream" codebase any user of progress-linux currently relies upon.
and again, progress-linux appears to just be a personal project of
Daniel's, with afaik very little userbase. (Daniel seems to be the only
developer working on the project which speaks to how small it is).

[1]: https://salsa.debian.org/live-team/live-build/-/merge_requests/142

Gbp-Dch: Short
2020-03-20 10:19:33 +00:00
Lyndon Brown d6a80d3d4d defaults: purge long unused LB_ROOT
seems to have been obsolete since all the way back at v1.0~a22-1.

history:
 - in 0d0de885e3 it was renamed from
   LIVE_ROOT to LH_ROOT, but also seems to have become completely
   obsolete at this point, and thus mistakenly not actually removed.
   before this it seems to have been used to hold the base directory of
   live-build from which paths were constructed, but then this use was
   removed making it redundant, but it remained in the code.
 - 83bc63f725 renamed to LB_ROOT.
 - a79a5bea10 dropped setting the variable
   only if not already set, in favour of always setting it depending upon
   LB_MODE. but still it remained unused.

Gbp-Dch: Short
2020-03-20 10:19:33 +00:00
jnqnfe 4fa83598a3 grub: remove old and unused splash code
The LB_GRUB_SPLASH variable is populated by the --grub-splash param
but is not actually used for anything.

Gbp-Dch: Short
2020-03-20 10:02:52 +00:00
Lyndon Brown 406accfab9 defaults: remove redundant setting of LIVE_BUILD
this is handled for every script in build.sh. this is not stored in the
saved config or anything, so no need to re-evaluate in
`Set_config_defaults`. this just seems to completely pointless.

Gbp-Dch: Short
2020-03-19 16:33:25 +00:00
Lyndon Brown b7896564c5 defaults: bump checksums to stronger form
md5 & sha1 are not considered secure anymore and thus are of questionable
value here if checksums are wanted.

Gbp-Dch: Short
2020-03-18 14:47:22 +00:00
Lyndon Brown c55eb8a0c3 use local scope for private function vars
all vars affected have been carefully checked to be quite certain
that they are definitely local

where variable is assigned the return value of a function/command, the
local "declaration" is deliberately done on a separate line, since
`local FOO` is actually treated itself as a command rather than a
declaration; will thus always cause $? to be zero, and thus if done on
the same line as such an assignment can not only clobber $? but in doing
so unintentionally blocks failure of a command from triggering the
expected exit from having `set -e`.

also, from testing, i have found that when assigning "${@}" this must be
done on a separate line confusingly as otherwise an error occurs.

Gbp-Dch: Short
2020-03-16 22:10:03 +00:00
Lyndon Brown ca520eb5f0 split stdout & stderr auto colouring
thus for some reason if one is connected to a tty and the other a file,
we still get colour in the tty by default.

in terms of options, --color and --no-color override both, no granular
ones added since it's not worth it imo.

this is backwards compatible with custom configs setting `_COLOR`.

it could be argued that setting $_COLOR to "false" for the auto non-tty
cases is redundant, which it is, but it doesn't hurt to do so; it ensures
that if anything (inc. 3rd-party hooks and such) rely on it that it
remains correct; and ensures that if anything in the future mistakenly
uses $_COLOR instead of $_COLOR_OUT|$_COLOR_ERR that at least that will
only be broken for the use case of only one of stdout|sdterr being a tty.

Gbp-Dch: Ignore
2020-03-16 13:32:16 +00:00
Lyndon Brown 09b279b7bc turn on colour by default
...when stdout+stderr connected to a tty (as opposed for example to being
piped to a log file)

very helpful to have colour such that the red/yellow of errors/warnings
can draw the eye to problems.

Gbp-Dch: Short
2020-03-16 13:32:16 +00:00
Luca Boccassi 015e6b65f3 Revert "Test for executables: replace 'which' with more robust 'command -v'"
This reverts commit 2d9ab1f7f8.

Causes test failure due to bashism.
2020-03-12 12:32:26 +00:00
johnraff 2d9ab1f7f8 Test for executables: replace 'which' with more robust 'command -v'
Instances of:
if [ $(which <command> ]
have been replaced with:
if command -v <command> >/dev/null
which is considered to be more robust in a range of environments.

scripts/build/chroot_archives: line 259:
	if [ "${LB_APT}" = "aptitude" ] && [ ! $(Chroot chroot "which aptitude") ]
has been left untouched because the chroot might require a more complex command
which would need more testing.

manpages/Makefile: line 42:
	@if [ ! -x "$$(which po4a 2>/dev/null)" ]; \
has been left untouched because I am not sufficiently familiar with makefiles.
2020-03-12 10:35:57 +00:00
Lyndon Brown 72a87fb70d fix error for default hdd|netboot images
commit f811656150 enabled the grub-efi
bootloader by default for amd64|i386 architectures, but failed to
recognise the this bootloader is not supported for hdd|netboot images.

this meants that if a user tried to build such an image without explicitly
specifying the bootloader, excluding grub-efi, their build would fail
with an error in the binary_grub-efi stage.

this fixes the problem by only enabling grub-efi by default on supported
image builds.
2020-03-12 10:33:13 +00:00
Lyndon Brown 1e0339a4e3 remove obsolete loop-aes-utils related losetup hack
677415f6d7 (2007) in v1.0~a2-1 added a hack
relating to the loop-aes-utils package and losetup. this commit bundled
a bunch of changes, it was not specific to the hack, and so info about the
hack is limited to a brief comment included within the related change in
defaults:
```
# Workaround for loop-aes-utils divertion
# (loop-aes-utils' losetup lacks features).
```
though it is very similar to the removed fdisk hack in that it seems that
one package may replace a binary from another, moving the original to a
new location, and this hack gives the user the opportunity to select the
original instead of the one put in its place, for use in LB.

the comment mentions a package called loop-aes-utils as being the package
that performs such a diversion, and that the need for the hack was that
losetup itself lacked features, presumably encryption support, and it is
clear that it is the losetup binary that is the focus of the diversion.

looking into the history of loop-aes-utils a little, this package was
dropped from debian back in 2012 (#680748), favouring encrytion support of
dm-crypt/cryptsetup.

double checking file contents of packages, only the mount package carries
an /sbin/losetup file, so presumably this means that dm-setup/cryptsetup
do not perform such a diversion of losetup (i.e. their use is exclusively
done directly).

since the possible diversion is simply gone, that completely removes any
point in having the hack of giving users choice between losetup and the
diverted one. so let's remove this obsolete hack...
2020-03-12 10:31:39 +00:00
Lyndon Brown d9f353c737 remove obsolete fdisk hack
8321653cb3 (from 2007) introduced a hack to
work around bug #445304 in gnu-fdisk for users who may have replaced fdisk
with the classic gnu version. the hack allowed users to select an alternate
fdisk binary to use to work around the buggy binary.

bug #445304 is marked as found in v1.0-1 and fixed in v1.2-1, though may
have been fixe din v1.1. it was marked fixed in 2009.

checking the package archive, gnu-fdisk does not actually exist anymore
in debian, with one exception - it is available for arm64 on sid via
debports, and that version is 1.3 so thus includes the necessary fix
anyway.

it is thus pointless now that we still carry this hack.

Gbp-Dch: Short
2020-03-11 19:06:54 +00:00
Lyndon Brown dab716e079 "Live Systems" -> "Debian Live" 2020-03-11 15:23:31 +00:00
Lyndon Brown 7a4a9f94b8 amend copyright & licensing blocks
Current versions of the project files are built upon versions published
and licensed by Daniel Baumann, but are modified copies of those files and
thus need to be marked as such per licensing requirements (afaik he did
not pass along ownership / licensing rights to anyone when he left the
project). We should also be careful to not be misrepresenting such
modified copies as being attributed to Daniel.

Adding a new copyright line referring to "The Debian Live team" should
suffice for this.

The authorship block in man pages has also similarly been updated.

Notes:
 - tweaked a copy of daniel copyright lines stating 2014 instead of 2015.
   both of these cases were in files that i had personally introduced in
   some of my past merged commits that moved some code around. i don't know
   why they stated 2014.
 - binary_onie was introduced in 2018, so that has a 2018 date instead of
   2016 unlike the rest.
 - 'efi-image' is a 3rd-party (Canonical Ltd) work that we bundle, but it
   has been modified by 674794a8f4 and
   36a3ba7634 so I similarly added a
   debian live copyright line.
 - 'grub-cpmodules' is similar. it was only changed by the indentation fix
   of 36a3ba7634 but modification is
   modification, and this does help cover any possible future changes that
   might be made.
2020-03-11 13:51:19 +00:00
jnqnfe 0dee07f122 config: rename the config set/check functions for clarity
Gbp-Dch: Short
Closes: #952920
2020-03-10 12:39:37 +00:00
Lyndon Brown 7ee59d408e fix consistency in binary execution and existance checking
- prefer using `which` over hard coded paths
 - it is redundant to check that the bin pointed to the return of
   `which` exists and is executable, `which` already gives us
   assurance of that if it returns true!
 - the redirection of output (`2>/dev/null`) seems to be
   unnecessary from my testing.

the instances relatnig to fdisk and losetup in functions/defaults.sh have
been left as they are since they get executed by `lb config` which can run
without sudo elevation unlike `lb build` and in that case `which` would
fail to find these binaries resulting in error.

this also fixes a bug showing an error for missing debootstrap - this tool
requires sudo privileges to run and thus is not found via a none elevated
which search.

Gbp-Dch: Short
Closes: #952927
2020-03-09 10:51:11 +00:00
jnqnfe 7624527d77 defaults: ensure global caching param overrides specific caching params if disabled
Closes: #952923
2020-03-09 10:38:09 +00:00
jnqnfe 3897aac77a defaults: fix pointlessly split line error
inconsistent with all other output

Gbp-Dch: Ignore
Closes: #952874
2020-03-05 11:41:53 +00:00
Lyndon Brown 3840ac2005 memtest: better handle obsolete LB_MEMTEST value
available values currently are memtest86+|memtest86|none; "false" is
presumably handled for backwards compatibility

there is no need to handle this in individual scripts. the right place
to handle it is in Set_Defaults as now done

Gbp-Dch: Short
Closes: #952866
2020-03-05 11:39:57 +00:00
jnqnfe fcafaede19 simplify --debian-installer choices
`false` and `none` make no sense as choices for this option. Here we
replace `false` with `none`, and remove `true`.

Note that `true` was treated as an alias for netinst (see the changes to
source_disk and and binary_disk).

For backwards compatibility we still allow `true` and `false` by converting
them to `netinst` and `none` respectively, whilst printing a warning to
encourage users to move to `netinst`/`none`.

Gbp-Dch: Short
Closes: #952864
2020-03-05 11:36:55 +00:00
Lyndon Brown 36a3ba7634 fix indentation
including:
 - spaces replaced with tabs for consistency
 - alignment of `;;` in some case statements changed for consistency

Gbp-Dch: Short
Closes: #952857
2020-03-05 11:29:01 +00:00
Raphaël Hertzog be5aaa0c51 Get rid of extraneous whitespace showing up in syslinux menu
The leading space ends up in the FLAVOUR substitution in live.cfg.
2020-01-22 15:00:06 +01:00
Raphaël Hertzog 44b9b0a650 Support --distribution-binary and --distribution-chroot
This makes it possible to build an image against a first distribution
(--distribution-chroot) and have the resulting image point to another
distribution (--distribution-binary). We can use this to build against a
snapshot and have the result use the original distribution that was
snapshotted.

Closes: #888507
2019-12-19 18:18:44 +01:00
Raphaël Hertzog 15c46fa152 Set default distribution to buster
Closes: #934495
Thanks: Алексей Шилин
2019-12-19 16:43:51 +01:00
Roland Clobus c035b3f106
Updated URL in the LB_ISO_PUBLISHER field. 2019-04-17 21:29:34 +02:00
Roland Clobus f460533ca1
Updated URL in the LB_ISO_PREPARER field. 2019-04-17 21:27:04 +02:00
Adrian Gibanel Lopez 80aa5ab611 Fixed foreign architecture package support to linux kernel flavours
Before Stretch there was an special amd64 kernel in the i386 arch repo.
So if you wanted to install an amd64 kernel alongside an i386 system
you did not need an additional arch repo.

Debian added multiarch support. That way you can install library packages
from multiple architectures on the same machine.

So there is no longer a need for having an amd64 kernel in i386 arch repo.
You can add an amd64 arch repo to an i386 arch system and fetch the amd64
kernel from the am64 arch repo.

live-build can be setup to use several linux kernel flavours in a single
image.

So in the days previous to this patch you could issue:
lb config --linux-flavours "486 amd64"
to use both 486 and amd64 kernel flavours.

Adding additional arch support to linux flavours poses two problems:

* Packages need to have its arch suffix (e.g. amd64:amd64).
If the suffix is not there apt-get insists on search amd64 kernel
package on i386 arch repo and, of course, fails to find it.

* The rest of the code which handles labels (bootloader config files)
or installed filenames (kernel images themselves) do not use the arch suffix.

This patch adds foreign architecture package support to
linux kernel flavours having taken those problems into account.

Practical example usage: i386 system and extra amd64 kernel.

First add amd64 foreign architecture in your i386 system
thanks to:

dpkg --add-architecture amd64
apt-get update

.

Finally enable amd64 kernel from amd64 arch alongside the
i386 system's 686 kernel thanks to:

lb config --architectures i386 --linux-flavours "686 amd64:amd64"
2019-03-14 23:06:31 +01:00
Hideki Yamane 2fa258cca2 use deb.debian.org as default
replace deprecated httpredir.debian.org to deb.debian.org and use
it as default mirror since it is appropriate for users
2018-10-13 12:39:42 +09:00
Luca Boccassi 46c9596926 Add options to build ONIE images
Open Network Install Environment is an open image format used by
networking vendor to ship a standardised image for networking white
box switches.

ONIE hardware takes this image at boot and a script to chain load
into the final environment via kexec. We can support Debian and
derivatives on such systems by packing an ISO which then gets
unpacked, kexec'ed and live-booted.

A base ONIE system can be tested in QEMU by building a VM following
these instrunctions:

https://github.com/opencomputeproject/onie/blob/master/machine/kvm_x86_64/INSTALL

Once built, boot onie-recovery-x86_64-kvm_x86_64-r0.iso in QEMU/libvirt
and on the console there will be the terminal prompt. Check the IP
assigned by libvirt and then scp the live image (ssh access is enabled
as root without password...). Then the .bin can be booted with:
 ONIE-RECOVERY:/ # onie-nos-install /tmp/live.hybrid.iso-ONIE.bin

The implementation is inspired by ONIE's own scripts that can be found
at:
https://github.com/opencomputeproject/onie/blob/master/contrib/debian-iso/cook-bits.sh

A new option, --onie (false by default) can be set to true to enable
building this new format in addition to an ISO.
An additional option, --onie-kernel-cmdline can be used to specify
additional options that the ONIE system should use when kexec'ing the
final image.
Note that only iso or hybrid-iso formats are supported.

For more information about the ONIE ecosystem see:
http://onie.org

Signed-off-by: Erik Ziegenbalg <eziegenb@Brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
2018-03-22 16:14:01 +00:00
Luca Boccassi 035518ff69 UEFI: add support for Secure Boot on amd64 and arm64
Support for UEFI Secure Boot is modelled after how it currently works
in Ubuntu and on how it is going to work on Debian.
A minimal bootloader, shim, is used as the first-stage and it then
loads grub. Both have to be signed.
shim-signed is already available in Debian so the filenames are
already established, and the grub2 repository and packaging is common
between the 2 distros so we can already be reasonably sure of what it
is going to be.
So if both are available, copy /usr/lib/shim/shim[x64|aa64].efi.signed
as boot[x64|aa64].efi so that UEFI loads it first, and copy
/usr/lib/grub/[x86_64|arm64]-efi-signed/grub[x64|aa64].efi.signed as
grub[x64|aa64].efi.
This grub2 EFI monolithic image is currently hard-coded in grub2's
repository to look for a config file in efi/debian, so make a copy
of the previously added minimal grub.cfg that loads the real one in
that directory in both the fat32 and ISO 9660 partitions.

The new option --uefi-secure-boot can be set to auto (default,
enable or disable.
In auto, the lack of the signed EFI binaries is intentionally left as a
soft failure - live-build will simply fallback to using the locally
generated non-signed grub2 monolithic EFI binary as the only
bootloader. Given the difficulties surrounding the Secure Boot
signing infrastructure this approach gives the most flexibility and
makes sure things will "just work" once the packages are available,
without the need to change anything in the configuration.
This will also greatly help downstream distributions and users who
want to do self-signing.
The enable or disable options work as expected.

Closes: #821084
2018-03-09 20:57:54 +00:00
Raphaël Hertzog 2f54fcf3d7 Replace "kirkwood" and "orion5x" armel flavors with the new "marvell" one
As done by the linux source package since its version 4.4.
2017-09-18 18:00:20 +02:00
Raphaël Hertzog c5a334deb8 Update PREPARER data for consistency 2017-08-29 15:06:35 +02:00
Raphaël Hertzog 3f909bf486 Drop all references to live-systems.org and update copyright file
Also fix the version string in the manual pages.

Closes: #859290
2017-08-29 14:12:33 +02:00
Raphaël Hertzog d98f95bbbe Drop the versatile kernel flavour on armel. It's no longer built since Linux 4.9. 2017-02-13 16:52:10 +01:00
Raphaël Hertzog 61b92c654e Drop check on configuration version
The date based versioning scheme no longer allows such a check. And we
don't intend to break backwards compatibility for now.
2016-12-02 23:05:05 +01:00
Raphaël Hertzog 7ad6c408e5 Default for LB_UNION_FILESYSTEM is now "overlay" just like in live-boot. 2016-12-02 15:10:19 +01:00
Adrian Gibanel Lopez f811656150 Make: syslinux,grub-efi the default bootloaders because
UEFI is getting widely adopted but BIOS support is still
needed.
2016-07-31 15:09:13 +02:00
Adrian Gibanel Lopez ee9a6de2cc defaults.sh LB_BOOTLOADER updated to be: LB_BOOTLOADERS in incompatible warning 2016-07-31 15:09:13 +02:00
Adrian Gibanel Lopez 9d1a983cc8 Added new multi bootloader helper functions
* Added: functions/bootloaders.sh . This file adds bootloader functions that are heavily used in efi scenarios where a bootloader can act as a first or an extra bootloader.

Since the introduction of the new switch:

--bootloaders

you can setup it like this:

--bootloaders=syslinux,grub-efi

.

This means that syslinux is the first bootloader and grub-efi is the extra bootloader.

* Added new bootloader functions: Check_Non_First_Bootloader and Check_Non_Extra_Bootloader.

These functions let each one of the bootloaders abort the build because
they cannot perform a role either as a first bootloader or as an extra bootloader.

* Added bootloader functions: Check_First_Bootloader_Role, Check_Extra_Bootloader_Role and Check_Any_Bootloader_Role

These functions let bootloaders to force their default role in a single line.

At the same time many binary bootloaders were rewritten to make use of the new bootloader role functions explained above.

These roles were enforced:

binary_grub-legacy : First bootloader
binary_grub-pc : Either first or extra bootloader
binary_syslinux : Either first or extra bootloader

If a bootloader is tried to be used in a role that it's not meant to be used then the build fails because that might lead to a non-bootable system.
2016-07-31 15:08:11 +02:00
Adrian Gibanel Lopez 01a9df8ce3 functions/default.sh : Define LB_PRIMARY_BOOTLOADER at the Set_defaults function which it's the right place where to do it 2016-07-31 14:59:33 +02:00
Raphaël Hertzog 7f4e2654e4 Drop ixp4xx from available armel flavors
It's gone from Debian unstable/testing since Linux 3.17.

Sponsored-By: Offensive Security
2016-01-05 18:10:00 +01:00
Ben Armstrong 1f8975cc60 Remove 586 flavour for i386 architecture. (Closes: #807972) 2015-12-15 14:01:29 +00:00
Adrian Gibanel Lopez d515ae5684 Multi bootloader support
Note: OLDIFS use makes IFS to be reset to "" instead to it being unset.
Either we need to detect if old IFS was unset to unset it
or we need a proper way of setting it as a local variable.
Even more IFS it's not currently used in
Check_package (which it's called from: binary_hdd).
we should have a clean way of resetting/unsetting IFS when calling Check_package.

The other approach it's to explicitly define IFS with its default value in the
places inside live-build code where we implicitly suppose that it's going to have
its default value.
2015-08-29 23:56:41 +02:00
Daniel Baumann 9280926b11 Switching from http.debian.net to httpredir.debian.org as default binary mirror. 2015-05-10 19:10:28 +02:00
Daniel Baumann 279a149d8a Dropping automagics for ubuntu.
Future live-build versions will still allow to use casper,
but its configuration will be done differently by a custom
config tree, rather than embedded and maintenance intensive
code in live-build itself.
2015-05-03 16:03:10 +02:00
Daniel Baumann f93e83e351 Dropping automagics for casper.
Future live-build versions will still allow to use casper,
but its configuration will be done differently by hooks
in the config tree, rather than embedded and maintenance intensive
code in live-build itself.
2015-05-03 15:50:03 +02:00
Daniel Baumann 7e633e77f2 Moving grub and grub2 templates into shared bootloader config directory. 2015-04-29 07:52:56 +02:00