Commit Graph

177 Commits

Author SHA1 Message Date
Dave Reisner
67dcb08f4b genfstab: make -p default behavior, add -P as inverse
This should be the default, as you generally don't want to include
pseudofs mounts in your /etc/fstab.
2014-12-26 11:54:24 -05:00
Dave Reisner
e44af861eb use consistent messaging for chroot_setup failure 2014-12-16 23:15:17 -05: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
25c058a2a2 explicitly exit from TEST_exit
This prevents some odd interactions with the EXIT trap, and our last
command's status is seemingly not preserved for the script's real exit.

Add a BASH override to the Makefile as well, as it might be useful for
debugging or testing against other versions of bash.
2014-12-15 08:38:43 -05:00
Dave Reisner
7b4cf9a637 prepare v14 2014-12-12 18:43:21 -05:00
Dave Reisner
2be79c6259 run the chroot in a new PID namespace
This automatically tears down any processes remaining in the chroot
when we exit. I'm looking at you, gnupg.
2014-12-11 21:40:52 -05:00
Dave Reisner
02062d2bd6 Merge pull request #21 from abraithwaite/patch-1
Remove redundant variable declaration
2014-10-30 18:07:47 -04:00
Alan Braithwaite
a54860044f Remove redundant variable declaration
Unless I'm mistaken, newroot is assigned later, and never referenced in between:
```
(( $# )) || die "No root directory specified"
newroot=$1; shift
```
2014-10-30 14:19:48 -07:00
Dave Reisner
f726f8c22c genfstab: add vfat quirk 2014-04-06 10:48:15 -04:00
Dave Reisner
80466e0412 common: add support for getting optstr values 2014-04-06 10:48:15 -04:00
Dave Reisner
03121cb504 genfstab: add option quirks for f2fs
FS#38019.
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
3b58d68669 prepare v13 2014-02-05 15:20:13 -05:00
Dave Reisner
481919edc1 README: fix typo 2014-01-26 15:58:25 -05:00
Dave Reisner
a1b4145ff2 Add tests for some common functions 2013-12-08 22:59:15 -05:00
Dave Reisner
756e831bd5 genfstab: mangle tag values when needed 2013-12-08 22:42:49 -05:00
Dave Reisner
5e5c979126 common: avoid need for fallthrough 2013-12-08 22:42:49 -05:00
Dave Reisner
a93aab3f43 genfstab: fix deleted file parsing
backslashes in single quotes don't need escaping. We need to match the
literal string \040deleted.
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
1823820546 prepare v12 2013-11-29 14:09:06 -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
1f2a6b9b71 genfstab: check sooner for pseudofs types 2013-07-14 12:24:34 -04:00
Dave Reisner
026f54428d genfstab: remove obsolete check for overlapping modes
1f03775f4f introduced arbitrary tag identification which removed the
variables this conditional checks.
2013-07-14 12:21:41 -04:00
Dave Reisner
15513c4a06 prepare v11 release 2013-05-26 15:51:41 -04:00
Dave Reisner
d0fbf5548d Makefile: add check target for syntax check 2013-05-26 15:47:56 -04:00
Dave Reisner
c6af176666 genfstab: be more careful about assigning passno 2013-05-26 11:41:53 -04:00
Dave Reisner
56e438869c genfstab: prefer lsblk over blkid
lsblk has a far nicer interface and is capable of doing its work
without the need for extra privileges to read superblocks (assuming
udev is behaving properly).
2013-05-23 13:23:48 -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
99e6b07ab3 genfstab: derive the real type of fuseblk filesystems 2013-05-02 14:09:52 -04:00
Dave Reisner
cbc1ece119 prepare for release v10 2013-01-04 13:34:00 -05:00
Dave Reisner
f37396d153 add a skeleton README file 2012-12-28 23:37:02 -05: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
92fdaa397b add GPL2 license file 2012-12-12 21:00:41 -05:00
Dave Reisner
0bde888ba4 makefile: scripts depend on common 2012-12-12 09:04:45 -05:00
Dave Reisner
e4b4e30213 genfstab: correctly specify bind as option
'bind' is an option, not an fstype. In the case of a bind mount, the
fstype is ignored.
2012-12-09 14:05:41 -05:00
Dave Reisner
2179b43b0f genfstab: skip deleted swap files 2012-12-09 13:59:27 -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
d7624977d3 genfstab: fix typo in comment 2012-11-24 12:38:18 -05:00
Dave Reisner
be6afd2b30 prepare v9 2012-11-17 10:54:59 -05:00
Dave Reisner
326e62284c genfstab: trim leading slash from btrfs subvol 2012-11-14 19:38:27 -05:00
Dave Reisner
04c137cfae genfstab: fix root passno assignment
leverage findmnt to match the source device to the root partition. I
wonder how long until btrfs invalidates this approach.
2012-11-14 19:36:13 -05:00
Dave Reisner
cf84170321 add the -h option to the usage 2012-11-12 21:00:09 -05:00