summaryrefslogtreecommitdiff
path: root/functions/echo.sh
AgeCommit message (Collapse)Author
2020-05-02tidy up Echo_breakage()Lyndon Brown
- 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-03-16use local scope for private function varsLyndon Brown
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-16split stdout & stderr auto colouringLyndon Brown
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-13fix colouring of notice type message prefixesLyndon Brown
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-13echo: really ensure log messages go to stdoutLyndon Brown
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 e3a987d977aaa417afe74349fa4d97dd6afc1c94 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-11amend copyright & licensing blocksLyndon Brown
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 674794a8f4d61a729d2dbd6d99385d2826138694 and 36a3ba76347ef72df1c316312ed3a26aa4b0c816 so I similarly added a debian live copyright line. - 'grub-cpmodules' is similar. it was only changed by the indentation fix of 36a3ba76347ef72df1c316312ed3a26aa4b0c816 but modification is modification, and this does help cover any possible future changes that might be made.
2020-03-09echo: fix bad colour choiceLyndon Brown
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-09echo: don't mangle backslashes for file printingLyndon Brown
2020-03-05echo: tidyLyndon Brown
Gbp-Dch: Ignore
2020-03-05echo: purge unused *_running echo helpersLyndon Brown
Partial fix for #952880 Gbp-Dch: Short
2020-03-05echo: purge some unused echo helpersLyndon Brown
Partial fix for #952880 Gbp-Dch: Short
2020-03-05echo: direct warnings via echo helper to stderrLyndon Brown
2020-03-05echo: ensure output goes to stdout/stderrLyndon Brown
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-05echo: fix problem with error printingLyndon Brown
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-05don't unnecessarily convert exit codes to stringsLyndon Brown
Closes: #952861
2019-12-19Support --distribution-binary and --distribution-chrootRaphaël Hertzog
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
2015-01-04Updating year in copyright notices to 2015.Daniel Baumann
2014-02-08Updating copyright notices for 2014.Daniel Baumann
2013-05-06Removing all references to my old email address.Daniel Baumann
2013-05-06Updating year in all copyright notices.Daniel Baumann
2013-05-06Adding debian version 4.0~a1-1.debian/4.0_a1-1Daniel Baumann
2013-01-01Updating year in all copyright notices.Daniel Baumann
2012-07-30Updating GPL standard header in all files.Daniel Baumann
2012-07-27Updating all distribution specific selectors in defaults to be as future ↵Daniel Baumann
proof as possible.
2012-06-06Removing unmaintained l10n handling.Daniel Baumann
2012-06-06Updating l10n stuff before removing it.Daniel Baumann
2012-02-06Updating year in copyright notices for 2012.Daniel Baumann
2011-03-09Updating year in hooks and script files.Daniel Baumann
2011-03-09Adding debian version 3.0~a1-1.Daniel Baumann
2011-03-09Updating year in manpage, hooks, script and template files.Daniel Baumann
2011-03-09Removing l10n support for 2.0 branch.Daniel Baumann
2011-03-09Updating internal variables from lh to lb scheme, should be the last piece ↵Daniel Baumann
to finish the live-helper to live-build rename.
2011-03-09Updating copyright headers for live-build.Daniel Baumann
2011-03-09Updating year to 2010 in copyright notices.Daniel Baumann
2011-03-09For consistency, using true|false instead of enabled|disabled in ↵Daniel Baumann
configuration options.
2011-03-09Updating year in copyright notices for 2009.Daniel Baumann
2011-03-09Adding missing newlines in Echo_errorAntonio Terceiro
2011-03-09Removing wrong 'new-line' in running echo functions when using no color output.Daniel Baumann
2011-03-09Adding missing arguments to printf (l10n disabled)Antonio Terceiro
Otherwise the extra arguments would be discarded, e.g. Echo "Loading defaults from %s" "${DEFAULTS_DIR}"
2011-03-09Removing double warning symbol.Daniel Baumann
2011-03-09Implementing colorful output (currently disabled by default, though).Daniel Baumann
2011-03-09Generalizing internal LH_VERBOSE variable.Daniel Baumann
2011-03-09Generalizing internal LH_QUIET variable.Daniel Baumann
2011-03-09Generalizing internal LH_DEBUG variable.Daniel Baumann
2011-03-09Generalizing internal LH_L10N variable.Daniel Baumann
2011-03-09Check for availability of gettext at runtime, and only use it if existing.Daniel Baumann
2011-03-09Don't use set -e in sourced functions, this is the job of the actual ↵Daniel Baumann
executed script.
2011-03-09Add utility to dump specified file to stdout.Chris Lamb
2011-03-09Adding generic echo function.Daniel Baumann
2011-03-09Adding last modifications in order to have localization fully working in ↵Tiago Bortoletto Vaz
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.