Commit Graph

47 Commits

Author SHA1 Message Date
Jan Kot 4d7c8c35e3 exit.sh: fix selinux mountpoint 2021-01-14 01:44:30 +01:00
Lyndon Brown 2d7ff4934d improve stagefiles encapsulation
- added and used Stagefiles_dir()
 - added and used Stagefile_exists()

pretty self explanatory.

Gbp-Dch: Short
2020-05-02 14:49:45 +01:00
Lyndon Brown bea349c822 exit: fix missing local scope
missed in c55eb8a0c3

Gbp-Dch: Ignore
2020-03-17 17:33:31 +00:00
Lyndon Brown 24c3582b2c exit: don't convert numeric exit code to string 2020-03-13 16:06:20 +00:00
Lyndon Brown 5a1c875cb8 exit: ensure an appropriate message is printed on unexpected exit
if a script exits due to a failure and `set -e`, we should ensure that an
error message is printed to be clear to the user that something actually
went wrong.

similarly it would be good to print a suitable message should the user
cancel with ctrl+c for instance.

Gbp-Dch: Short
2020-03-13 15:10:29 +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 6cec4a7a74 exit: fix no /usr/bin/env error
if you execute the bootstrap stage with no internet connection, you get
the following output:

```
[2020-03-10 19:18:46] lb bootstrap
P: Setting up clean exit handler
[2020-03-10 19:18:46] lb bootstrap_cache restore
[2020-03-10 19:18:46] lb bootstrap_debootstrap
P: Begin bootstrapping system...
P: If the following stage fails, the most likely cause of the problem is with your mirror configuration or a caching proxy.
P: Running debootstrap (download-only)...
I: Retrieving InRelease
I: Retrieving Release
E: Failed getting release file http://deb.debian.org/debian/dists/buster/Release
P: Begin unmounting filesystems...
P: Saving caches...
chroot: failed to run command ‘/usr/bin/env’: No such file or directory
```

the last line looked suspicious. investigating it turns out that there was
a deficiency in the exit handler.

when debootstrap fails to download what it needs due to lack of a
connection, that failure due to `set -e` causes the Exit() handler to kick
in. Part of this includes outputting the "Saving caches..." line, before
then making a call to Save_package_cache(). That in turn runs the following
command:
```
Chroot chroot "apt-get autoclean" || true
```
The Chroot() function includes a line starting with:
```
${_LINUX32} chroot "${CHROOT}" /usr/bin/env
```
which is the source of the last output line.

the reason we see this unexpected output is that with bootstrapping having
failed, there is no /usr/bin/env within the chroot so it is bound to fail.

the fact is, the exit handler has no business trying to pretty much
anything that it does if the bootstrap_debootstrap stage has not
completed.

this implements such a restriction and thus resolves the problem of this
unexpected and confusing output in the described situation.

we will now see:
```
[2020-03-10 19:18:46] lb bootstrap
P: Setting up clean exit handler
[2020-03-10 19:18:46] lb bootstrap_cache restore
[2020-03-10 19:18:46] lb bootstrap_debootstrap
P: Begin bootstrapping system...
P: If the following stage fails, the most likely cause of the problem is with your mirror configuration or a caching proxy.
P: Running debootstrap (download-only)...
I: Retrieving InRelease
I: Retrieving Release
E: Failed getting release file http://deb.debian.org/debian/dists/buster/Release
```
2020-03-11 09:55:37 +00:00
jnqnfe 061d7cb340 tidy script init (2/4) - build stage scripts
Partial fix for #952919

Gbp-Dch: Short
2020-03-10 12:39:37 +00:00
jnqnfe 055907592c cache: clarify and simplify package cache save/restore
These functions are specific to handling packages stored in the
cache, not other files. They are also always used with the same
`cache/packages.` prefix to the path.

Gbp-Dch: Short
Closes: #952916
2020-03-05 22:09:20 +00:00
Lyndon Brown 2511fff259 don't unnecessarily convert exit codes to strings
Closes: #952861
2020-03-05 11:33:12 +00: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
Ben Armstrong 8286f7d73c Fixing typo in cache directory names, thanks to Thanatermesis <thanatermesis@gmail.com>. 2012-11-14 21:51:38 +01:00
Daniel Baumann 508510e097 Updating GPL standard header in all files. 2012-07-30 18:19:27 +02:00
Daniel Baumann aa0c0fb107 Renaming internal .stage to .build for consistency within the configuration tree. 2012-06-03 22:42:41 +02:00
Daniel Baumann 822dc2c028 Updating year in copyright notices for 2012. 2012-02-06 23:15:12 +01:00
Daniel Baumann ee58b8ab8d Applying patch from Ivailo Monev to remove stage files for pseudo-filesystems helpers in exit function. 2012-02-06 23:15:10 +01:00
Matthijs Kooijman 02b9dc3ea9 Unmount /root/config in case of error.
When there is an error, the Exit() handler unmounts filesystems within
the chroot. This adds /root/config to the list used when /proc/mounts is
not available.
2012-01-10 21:54:58 +01:00
Daniel Baumann 80fa0406d9 Correcting wrong spelling of cache in exit function, thanks to David Endler for spotting it. 2011-09-07 20:00:40 +02:00
Daniel Baumann eb2a305a5f Saving packages in cache even when failing or interrupting a build (Closes: #586929). 2011-07-19 11:13:17 +02:00
Daniel Baumann 18eeaae602 Updating year in hooks and script files. 2011-03-09 19:20:42 +01:00
Daniel Baumann 772e2ad4bf Removing last live-helper remains in internal variables. 2011-03-09 19:20:39 +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 48f6f2105f Removing last live-helper remains in internal variables. 2011-03-09 19:17:31 +01:00
Daniel Baumann 4d22ca948a Updating copyright headers for live-build. 2011-03-09 19:17:18 +01:00
Daniel Baumann 3479891830 Also (try) unmounting /dev/shm in exit function. 2011-03-09 19:17:09 +01:00
Daniel Baumann 54518852c8 Updating year to 2010 in copyright notices. 2011-03-09 19:17:04 +01:00
Daniel Baumann 45406a5c98 Making unmount routines a bit more robust. 2011-03-09 19:17:03 +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 5611d7306e Returning error value of the last process before exiting (Closes: #527331). 2011-03-09 19:09:47 +01:00
Cody A.W. Somerville 6d1a6c1854 Unmounting all mounts in chroot. 2011-03-09 19:09:44 +01:00
Daniel Baumann 989f26d87b Updating year in copyright notices for 2009. 2011-03-09 19:09:40 +01:00
Daniel Baumann 3ff1c8050b Generalizing internal LH_DEBUG variable. 2011-03-09 19:03:43 +01:00
Daniel Baumann 425f88e9ec Updating signals in exit and lockfile traps. 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 f2d0d81ad0 Print message when Exit is called. 2011-03-09 19:03:43 +01:00
Chris Lamb 4c485f1853 Add utility function to call 'Exit' when script exits. 2011-03-09 19:03:43 +01:00
Daniel Baumann 4f9797c893 Adding unmount calls for pseudo-filesystems in Exit();. 2011-03-09 19:03:43 +01:00
Daniel Baumann ce7c2e2fe1 Removing LIVE_* grep from Exit(); as we have switched to LH_* variables long time ago. 2011-03-09 19:03:43 +01:00
Daniel Baumann c5a91189a0 Updating copyright years to 2008. 2011-03-09 19:01:41 +01:00
Daniel Baumann 8a4a50fdb6 Adding live-helper 1.0~a7-1. 2011-03-09 18:18:29 +01:00
Daniel Baumann 4739146fc6 Adding live-helper 1.0~a6-1. 2011-03-09 18:18:29 +01:00