Commit Graph

57 Commits

Author SHA1 Message Date
Lyndon Brown 5f318c5a44 tidy up Echo_breakage()
- it's only used by the debootstrap script after alternatives were dropped
   long ago, so let's move it, avoiding it being loaded for everything
   else.
 - there's no need to pass printing another message through it.
 - there's little point in making the sid distinction if you happen to
   decide to build sid, it's a given that it's less stable than stable.

really, is there any need for this at all?

Gbp-Dch: Ignore
2020-05-02 13:06:17 +01: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 346e3e1c36 fix colouring of notice type message prefixes
previously this was white+bold. the white aspect was dropped since this
would not be sensible for users with a white background for their terminal.
bold however does not have any effect for me at least so effectively there
is no highlighting at all.

here we reintroduce a colour, one that will work for both black and white
backgrounds of course. purple looks good to me - significantly different
to that used for errors and warnings, and works well with command
highlighting (as enabled separately).
2020-03-13 15:23:13 +00:00
Lyndon Brown c54cc2c497 echo: really ensure log messages go to stdout
all echo helpers are used as logging functions with output to go to the
terminal. when used in functions that are designed to return a string
though the message printed would get incorrectly captured.

the previous fix done in e3a987d977 was
stupidly flawed; somehow my testing led me to mistakenly believe that
was adequate, but retesting proves that it was not.

here we create a new FD #3 linked to stdout to output the messages on,
which testing shows works as I had actually intended it.

e.g. here:
```
Foo () { if [ "$1" = "a" ]; then printf "foo\n"; else printf "error\n"; fi; }
```

we get:
```
~$ Foo a
foo
~$ Foo b
error
~$ XX="$(Foo a)"
~$ echo "${XX}"
foo
~$ XX="$(Foo b)"
~$ echo "${XX}"
error
```

and as demonstrated, "error" got incorrectly captured by in the variable

whereas here:
```
exec 3>&1
Foo () { if [ "$1" = "a" ]; then printf "foo\n"; else printf "error\n" >&3; fi; }
```

it is different in the last case:
```
~$ XX="$(Foo b)"
error
~$ echo "${XX}"

```

the error successfully makes it to the terminal, and the variable is an
empty string (with a newline automatically printed).

Gbp-Dch: Short
2020-03-13 13:50:35 +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
Lyndon Brown 62b3efa686 echo: fix bad colour choice
white is not going to work well on a terminal with a white background,
obviously. We should keep the standard colour and just try applying the
bold.

or do we want to consider a non black/white colour? like blue...?

Gbp-Dch: Short
2020-03-09 12:52:08 +00:00
Lyndon Brown a6c4094cf0 echo: don't mangle backslashes for file printing 2020-03-09 12:47:08 +00:00
Lyndon Brown cac44b28d5 echo: tidy
Gbp-Dch: Ignore
2020-03-05 21:04:23 +00:00
Lyndon Brown 73c1100c01 echo: purge unused *_running echo helpers
Partial fix for #952880

Gbp-Dch: Short
2020-03-05 21:04:23 +00:00
Lyndon Brown 06f632efdf echo: purge some unused echo helpers
Partial fix for #952880

Gbp-Dch: Short
2020-03-05 21:04:23 +00:00
Lyndon Brown 57a9428080 echo: direct warnings via echo helper to stderr 2020-03-05 21:04:23 +00:00
Lyndon Brown e3a987d977 echo: ensure output goes to stdout/stderr
all of these echo helpers are essentially 'logging' functions with output
always intended for stdout/stderr. lack of explicit stdout/stderr direction
means that their output could be captured unintentionally should they be
used within a function designed to construct a string.

Gbp-Dch: Short
Closes: #952879
2020-03-05 21:04:22 +00:00
Lyndon Brown b8e3a27324 echo: fix problem with error printing
lack of stderr directed output for the `E:` prefix meant that it would
not appear alongside the message in some use cases

Gbp-Dch: Short
Closes: #952878
2020-03-05 21:04:22 +00:00
Lyndon Brown 2511fff259 don't unnecessarily convert exit codes to strings
Closes: #952861
2020-03-05 11:33:12 +00: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
Daniel Baumann 242aef5d83 Updating year in copyright notices to 2015. 2015-01-04 20:05:44 +01:00
Daniel Baumann eb336bb782 Updating copyright notices for 2014. 2014-02-08 17:47:24 +01:00
Daniel Baumann 59ce459f40 Removing all references to my old email address. 2013-05-06 14:50:06 +02:00
Daniel Baumann 62d94a4454 Updating year in all copyright notices. 2013-05-06 14:50:03 +02:00
Daniel Baumann d1047e809a Adding debian version 4.0~a1-1. 2013-05-06 14:48:46 +02:00
Daniel Baumann a203b86fdd Updating year in all copyright notices. 2013-01-01 00:13:01 +01:00
Daniel Baumann 508510e097 Updating GPL standard header in all files. 2012-07-30 18:19:27 +02:00
Daniel Baumann a16be4ab5e Updating all distribution specific selectors in defaults to be as future proof as possible. 2012-07-27 23:29:19 +02:00
Daniel Baumann f74ac47691 Removing unmaintained l10n handling. 2012-06-06 19:59:15 +02:00
Daniel Baumann 46f13db55a Updating l10n stuff before removing it. 2012-06-06 19:59:15 +02:00
Daniel Baumann 822dc2c028 Updating year in copyright notices for 2012. 2012-02-06 23:15:12 +01:00
Daniel Baumann 18eeaae602 Updating year in hooks and script files. 2011-03-09 19:20:42 +01:00
Daniel Baumann c5c3f6133a Adding debian version 3.0~a1-1. 2011-03-09 19:19:23 +01:00
Daniel Baumann 2ddc0cef5d Updating year in manpage, hooks, script and template files. 2011-03-09 19:17:33 +01:00
Daniel Baumann 383519bff3 Removing l10n support for 2.0 branch. 2011-03-09 19:17:32 +01:00
Daniel Baumann 83bc63f725 Updating internal variables from lh to lb scheme, should be the last piece to finish the live-helper to live-build rename. 2011-03-09 19:17:21 +01:00
Daniel Baumann 4d22ca948a Updating copyright headers for live-build. 2011-03-09 19:17:18 +01:00
Daniel Baumann 54518852c8 Updating year to 2010 in copyright notices. 2011-03-09 19:17:04 +01:00
Daniel Baumann 701b5affd4 For consistency, using true|false instead of enabled|disabled in configuration options. 2011-03-09 19:17:03 +01:00
Daniel Baumann 989f26d87b Updating year in copyright notices for 2009. 2011-03-09 19:09:40 +01:00
Antonio Terceiro 6891cbe098 Adding missing newlines in Echo_error 2011-03-09 19:09:39 +01:00
Daniel Baumann 50c3576e0b Removing wrong 'new-line' in running echo functions when using no color output. 2011-03-09 19:03:45 +01:00
Antonio Terceiro 5f0876d99d Adding missing arguments to printf (l10n disabled)
Otherwise the extra arguments would be discarded, e.g.

  Echo "Loading defaults from %s" "${DEFAULTS_DIR}"
2011-03-09 19:03:44 +01:00
Daniel Baumann f070302f58 Removing double warning symbol. 2011-03-09 19:03:44 +01:00
Daniel Baumann c225229f29 Implementing colorful output (currently disabled by default, though). 2011-03-09 19:03:44 +01:00
Daniel Baumann ad6b01b388 Generalizing internal LH_VERBOSE variable. 2011-03-09 19:03:44 +01:00
Daniel Baumann cb0894b3b3 Generalizing internal LH_QUIET variable. 2011-03-09 19:03:43 +01:00
Daniel Baumann 3ff1c8050b Generalizing internal LH_DEBUG variable. 2011-03-09 19:03:43 +01:00
Daniel Baumann d3c29179ad Generalizing internal LH_L10N variable. 2011-03-09 19:03:43 +01:00
Daniel Baumann b28ffecee0 Check for availability of gettext at runtime, and only use it if existing. 2011-03-09 19:03:43 +01:00
Daniel Baumann 37d2fb4b0f Don't use set -e in sourced functions, this is the job of the actual executed script. 2011-03-09 19:03:43 +01:00
Chris Lamb 568f905c51 Add utility to dump specified file to stdout. 2011-03-09 19:03:43 +01:00
Daniel Baumann fe8484f3cd Adding generic echo function. 2011-03-09 19:03:39 +01:00
Tiago Bortoletto Vaz 6205a24620 Adding last modifications in order to have localization fully working in live-helper. This commit goes with some pt_BR translations just for testing. Thanks to Antonio Terceiro for helping and coding in some shell stuff. 2011-03-09 19:03:38 +01:00