Commit Graph

31 Commits

Author SHA1 Message Date
Eli Schwartz
e418a17468
Use bind mounts to reuse the hostcache
This avoids depending on pacman --root using the host config, making it
easier to move to --sysroot instead.
2018-05-29 12:03:38 -04:00
Dave Reisner
232784ec56 Don't bind mount non-mountpoint directory on itself
This essentially reverts 2ace610c. I'm forgetting the historical context
of what lead to that commit (but note that it predates the first tag).
The only thing I can think of is that genfstab doesn't produce the
correct output when root isn't a mountpoint, but that's a crap reason --
you won't need an fstab when you're calling pacstrap on a directory and
genfstab already complains when the provided root isn't a mountpoint.
2017-11-05 10:14:50 -05:00
Dave Reisner
6c0696b3d4 common: empty initialize rather than mangling environment
Instead of mangling the caller's environment, just scope our hexchars
and reinitialize them.
2017-08-20 16:37:04 -04:00
Dave Reisner
0b8efa0e42 common: add cgroup2 as a pseudofs 2017-06-29 08:23:30 -04:00
Dave Reisner
b5832066c5 rename chroot setup-related functions
make it more obvious that these are really related functions.
2014-12-15 23:23:39 -05:00
Dave Reisner
e0eaca918e fix valid_number_of_base
function execution halts entirely on a invalid base, so we never
actually get to our 'return 1'. I'm not sure how our expected failures
ever actually worked, but it's quite plain to see that:

  $ a=$(( 2#3 )); echo hi

Never echos "hi". Use a subshell in valid_number_of_base so that we can
properly "trap" execution, and return a meaningful result.
2014-12-15 13:40:00 -05:00
Dave Reisner
80466e0412 common: add support for getting optstr values 2014-04-06 10:48:15 -04:00
Dave Reisner
c0b87a0495 add option twiddling functions
these will be used in genfstab
2014-04-06 10:48:15 -04:00
Dave Reisner
7079910d71 common: be explict about in_array return values
Not doing this can lead to false positives when checking for existence
in empty arrays.
2014-02-06 17:25:19 -05:00
Dave Reisner
5e5c979126 common: avoid need for fallthrough 2013-12-08 22:42:49 -05:00
Dave Reisner
e6f844e367 common: fix errors in valid_number_of_base
Instead of trying to do bit twiddling on what might not even be a
number, just try to cast the subject to the target base.
2013-12-07 20:39:15 -05:00
Dave Reisner
7c53cd416b common: ignore errors from efivarfs mount failures
The existence of /sys/firmware/efi/efivars only indicates that we've
booted the kernel in EFI mode. It does not guarantee that the same
kernel has support for efivarfs. Since this isn't critical, don't fail
the whole api mount.
2013-11-29 14:08:37 -05:00
Dave Reisner
0270a2d3b9 common: quote conditional for efivar mount
Prevents failures when the chroot base contains whitespace.
2013-11-15 14:53:58 -05:00
Dave Reisner
c746f87fc3 common: mount /sys/firmware/efi/efivars if available 2013-11-14 14:45:37 -05:00
Dave Reisner
8f2bd395ec common: introduce mount_conditionally
This is potentially evil, but we're using hand crafted input to eval
which should be safe. Use this to bind mount the chroot dir if it isn't
already a mount point.
2013-11-14 14:45:33 -05:00
Dave Reisner
463027b919 api_fs_mount: mount sysfs read-only 2013-10-02 21:08:05 -04:00
Dave Reisner
be7dcaa799 track_mount: lazily initialize track_mount trap/storage 2013-10-02 19:53:37 -04:00
Dave Reisner
c6af176666 genfstab: be more careful about assigning passno 2013-05-26 11:41:53 -04:00
Dave Reisner
1d35997222 common: auto-register api_fs_umount EXIT trap
This corrects some weird/wrong EXIT trap decls in arch-chroot and
pacstrap that should have been touched as part of the cleanup in
517fcff074.
2013-05-23 12:06:29 -04:00
Dave Reisner
b240f6ea90 common: declare pseudofs types as hash 2012-12-16 12:35:38 -05:00
Dave Reisner
517fcff074 chroot: do better bookkeeping of mounted devices
This was brought up when a user tried to arch-chroot into the same
root twice from different terminals. The second chroot should fail, but
not tear down the tree that it doesn't own.
2012-12-16 12:07:20 -05:00
Dave Reisner
bfb2b966f9 avoid limiting size of /tmp in chroot
There's no particularly good reason for this limitation.
2012-12-08 14:43:24 -05:00
Dave Reisner
3a7eb157d1 genfstab: provide DM names for swap
We're kind enough to provide DM names for non-swap devices, but simply
use the /dev/dm-X nodes for swap, since that's what /proc/swaps provides
us with. Resolve the DM name out of sysfs and use this instead.

Fixes FS#32609.
2012-11-11 17:04:14 -05:00
Dave Reisner
f8e7c4e29d direct error output to stderr 2012-06-25 22:33:38 -04:00
Dave Reisner
80ed096ccf arch-chroot: Only conditionally use a bind mount on chroot
This mainly fixes the case where there's devices mounted under the
chroot directory. Creating a bind mount on top of this will obscure
these other mounts.
2012-06-22 19:04:46 -04:00
Dave Reisner
f4a7a8313a fix xtrace output on api mount 2012-06-20 10:26:50 -04:00
Dave Reisner
b61c8cb366 move mangle to common, add unmangle, use in genfstab
The %b formatter is too generic for us to use, as a sequence such as
'\b' is invalid for hex escaping, but valid for %b. Port over the logic
from util-linux's mangle mini-lib and use this instead. This supports
both 3 digits hex as well as 3 digit octal escapes, and will ignore the
more generic ascii based single character escapes. Output is always in
octal format to comply with fstab(5).
2012-06-18 10:50:52 -04:00
Pierre Schmitz
6fcfe3b268 Create a project Makefile
* the Makefile uses m4 to build the common lib into the scripts
* it includes install, uninstall and clean targets
* the dist target creates a source tar from a tag

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-06-18 11:17:42 +02:00
Dave Reisner
67ec87fef0 be more verbose about chroot actions 2012-06-17 21:11:34 -04:00
Dave Reisner
2ace610c2f common: ensure the chroot point is a mountpoint 2012-06-17 17:08:27 -04:00
Dave Reisner
f614a4ee87 initial commit 2012-06-17 15:17:50 -04:00