Commit Graph

9 Commits

Author SHA1 Message Date
Mike Yuan
8736a1b7d5
doc: remove footer
The information it provides is completely outdated
and pretty much irrelevant these days.
2024-04-07 00:30:43 +08:00
Mike Yuan
ef83a837fd
pacstrap: add option '-D' to skip pacman dependency checks
Closes #19
2022-10-28 18:28:30 +08:00
Mike Yuan
ddf3134077
pacstrap: add option '-P' to copy the host's pacman config to the target 2022-10-22 20:51:54 +08:00
Mike Yuan
8be9340001
pacstrap: add option '-K' to initialize an empty keyring in the new root 2022-08-25 22:45:07 +08:00
Sean Anderson
ee9db7d580 Add unshare mode to pacstrap
This adds an "unshare" mode to pacstrap. This mode lets a regular user
create a new arch root filesystem. We use -N because both -U and -u are
taken in pacstrap and arch-chroot, respectively. There are two major
changes to pacstrap: we need to run many commands in under unshare, and
the setup process for mounts is different.

Because unshare starts a new shell, it is difficult to run many commands
in sequence. To get around this, we create a function for the rest of
the commands we wish to run, and then declare all functions and
variables in the unshare'd shell. This is pretty convenient. An
alternative method would be to generate the shell script as a HERE
document, and pipe it to bash.

Because unshare starts a new shell, we can only communicate using
stdin/out and any command line arguments. And we need to defer some
setup until after we are root. To get around this, we create a function
for the rest of the commands we wish to run, and then declare all
functions and variables in the unshare'd shell. I also considered having
a separate helper script which would contain the contents of pacstrap().
But I think this would be confusing, because the logic would then live
in a separate file (instead of just a separate function). That method is
also tricky because every variable has to be passed in through the
command-line arguments. One last method would be to generate a script on
the fly (e.g. using a HERE doc). I think that method could work as well.

The primary difference to the setup process is that we need to mount
filesystems in a different manner:
- We bind-mount the root directory. This is so commands which want to
  determine how much free space there is (or otherwise work with mounts)
  expect a mount on /. We unmount it with --lazy, since otherwise sys
  will cause an error (see below).
- proc can be mounted multiple times and is mounted in the same way
- sys cannot be mounted again, but we can recursively bind-mount it.
  When mounted this way, we can't unmount it until the mount namespace
  is deleted (likely because sys has a number of sub-mounts), so we have
  to use --lazy when unmounting it.
- dev can be bind-mounted, but this results in errors because some
  packages try and modify files in /dev if they exist. Since we don't
  have permission to do that on the host system, this fails. Instead, we
  just bind-mount a minimal set of files.
- run is not bind-mounted, but is instead created as a new tmpfs.
  According to aea51ba ("Bind mount /run from host into new root"), the
  reason this was done was to avoid lengthy timeouts when scanning for
  lvm devices. Because unshare does not (and cannot) use lvm devices, we
  don't need to bind-mount.
- tmp is created as usual.

Closes: #8
2021-12-08 17:44:51 -05:00
Eli Schwartz
f3641171d9
doc: fix dumb typo, the pacman manpage is section 8 not 1
Fixes FS#70548
2021-04-22 14:02:27 -04:00
Eli Schwartz
193c61db31
doc: update pacstrap description to account for default 'base' changing
It's no longer a group, and is now a metapackage.

Fixes FS#65216
2020-09-08 15:46:32 -04:00
Eli Schwartz
e1a84d1056
pacstrap: support local file mode
Allow passing files to the underlying pacman command, instead of relying
on the syncdb. This allows fine-grained control over the package files
to be installed, which can be useful when initializing a build chroot
for reproducible builds.
2019-11-13 12:03:38 -05:00
Eli Schwartz
da67c1906f
doc: add manpages for all programs 2019-06-05 15:44:58 -04:00