#!/bin/bash # # Assumptions: # 1) User has partitioned, formatted, and mounted partitions on /mnt # 2) Network is functional # 3) Arguments passed to the script are valid pacman targets # 4) A valid mirror appears in /etc/pacman.d/mirrorlist # shopt -s extglob m4_include(common) newroot=/mnt hostcache=0 copykeyring=1 copymirrorlist=1 usage() { cat </dev/null' EXIT # mount API filesystems api_fs_mount "$newroot" || die "failed to setup API filesystems in new root" msg 'Installing packages to %s' "$newroot" if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then die 'Failed to install packages to new root' fi if (( copykeyring )); then # if there's a keyring on the host, copy it into the new root, unless it exists already if [[ -d /etc/pacman.d/gnupg && ! -d $newroot/etc/pacman.d/gnupg ]]; then cp -a /etc/pacman.d/gnupg "$newroot/etc/pacman.d/" fi fi if (( copymirrorlist )); then # install the host's mirrorlist onto the new root cp -a /etc/pacman.d/mirrorlist "$newroot/etc/pacman.d/" fi # vim: et ts=2 sw=2 ft=sh: