Compare commits

...

3 Commits

Author SHA1 Message Date
Eli Schwartz
db0b093076
pacstrap: use --sysroot instead of --root
Does not seem to work, there's no internet connection in the chroot
2018-06-18 03:23:01 -04:00
Eli Schwartz
8f7fc3f5d7
Generate or copy a pacman.conf into the newroot's /tmp directory
This makes pacstrap more compatible with migrating from --root to
--sysroot, since the pacman.conf will be required to come from the
newroot itself.
2018-06-18 03:21:48 -04:00
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
2 changed files with 11 additions and 12 deletions

1
common
View File

@ -88,6 +88,7 @@ chroot_setup() {
chroot_add_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_add_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_add_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
chroot_maybe_add_mount "(( hostcache ))" /var/cache/pacman/pkg "$1/var/cache/pacman/pkg" -o bind
}
chroot_teardown() {

View File

@ -76,32 +76,25 @@ shift $(( OPTIND - 1 ))
newroot=$1; shift
pacman_args=("${@:-base}")
if (( ! hostcache )); then
pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
fi
if (( ! interactive )); then
pacman_args+=(--noconfirm)
fi
if [[ $pacman_config ]]; then
pacman_args+=(--config="$pacman_config")
fi
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
# create obligatory directories
msg 'Creating install root at %s' "$newroot"
mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman,log} "$newroot"/{dev,run,etc}
mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman,log} "$newroot"/{dev,run,etc/pacman.d}
mkdir -m 1777 -p "$newroot"/tmp
mkdir -m 0555 -p "$newroot"/{sys,proc}
# mount API filesystems
chroot_setup "$newroot" || die "failed to setup chroot %s" "$newroot"
msg 'Installing packages to %s' "$newroot"
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
die 'Failed to install packages to new root'
if [[ $pacman_config ]]; then
pacman-conf --config "$pacman_config" "$newroot/tmp/pacman.conf"
else
pacman-conf > "$newroot/tmp/pacman.conf"
fi
if (( copykeyring )); then
@ -116,4 +109,9 @@ if (( copymirrorlist )); then
cp -a /etc/pacman.d/mirrorlist "$newroot/etc/pacman.d/"
fi
msg 'Installing packages to %s' "$newroot"
if ! pacman --sysroot "$newroot" --config /tmp/pacman.conf -Sy "${pacman_args[@]}"; then
die 'Failed to install packages to new root'
fi
# vim: et ts=2 sw=2 ft=sh: