diff --git a/bin/basestrap.in b/bin/basestrap.in index dc65bec..0a090db 100644 --- a/bin/basestrap.in +++ b/bin/basestrap.in @@ -31,7 +31,6 @@ branch=stable usage() { echo "usage: ${0##*/} [options] root [packages...]" echo " -C Use an alternate config file for pacman" - echo " -S Use an alternate config file for pacman-mirrors" echo " -B Use an alternate branch" echo ' -U Use a specific mirror' echo " -c Use the package cache on the host, rather than the target" @@ -60,14 +59,13 @@ opts=':C:B:U:cdGiM' while getopts ${opts} arg; do case "${arg}" in C) pacman_config=$OPTARG ;; -# S) mirrors_conf="$OPTARG" ;; + B) branch="$OPTARG" ;; + U) mirror="$OPTARG" ;; d) directory=true ;; c) hostcache=true ;; i) interactive=true ;; G) copykeyring=false ;; M) copymirrorlist=false ;; - B) branch="$OPTARG" ;; - U) mirror="$OPTARG" ;; :) echo "invalid argument ${arg}:$OPTARG"; usage 1;; ?) usage 0 ;; esac @@ -79,6 +77,7 @@ check_root (( $# )) || die "No root directory specified" newroot=$1; shift pacman_args=("${@:-base}") +pm_args=(-a -p "$newroot" -S "${branch}") ${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg") @@ -86,33 +85,26 @@ ${interactive} && pacman_args+=(--noconfirm) [[ -n $pacman_config ]] && pacman_args+=(--config="$pacman_config") +[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}") + [[ -d $newroot ]] || die "%s is not a directory" "$newroot" if ! mountpoint -q "$newroot" && ! ${directory}; then die '%s is not a mountpoint!' "$newroot" fi -mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak" -mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak" -printf '%s.UTF-8 UTF-8\n' en_US > "$working_dir/etc/locale.gen" -printf 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf" -printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf" - -pm_args=(-a -p "$newroot" -S "${branch}") - -[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}") +mv "$newroot/etc/locale.gen" "$newroot/etc/locale.gen.bak" +mv "$newroot/etc/locale.conf" "$newroot/etc/locale.conf.bak" +printf '%s.UTF-8 UTF-8\n' en_US > "$newroot/etc/locale.gen" +printf 'LANG=%s.UTF-8\n' en_US > "$newroot/etc/locale.conf" +printf 'LC_MESSAGES=C\n' >> "$newroot/etc/locale.conf" # create obligatory directories create_min_fs "$newroot" -# if [[ -n $mirrors_conf ]]; then -# if [[ ! -e $newroot/etc/pacman-mirrors.conf ]]; then - prepare_pac_mirrors "$newroot" - info "Configuring pacman-mirrors: %s" "${branch}" - pacman-mirrors "${pm_args[@]}" -# fi -# rm $newroot/usr/share/pacman-mirrors/mirrors.json -# fi +if [[ ! -e $newroot/etc/pacman-mirrors.conf ]]; then + pacman-mirrors "${pm_args[@]}" +fi # mount API filesystems chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root" diff --git a/bin/buildiso.in b/bin/buildiso.in index 8f4cd35..91a95d9 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -41,8 +41,6 @@ prepare_build(){ pacman_conf="${DATADIR}/pacman-$pac_arch.conf" fi -# local mirrors_conf=${DATADIR}/pacman-mirrors.conf - iso_file=$(gen_iso_fn).iso mkchroot_args+=(-C ${pacman_conf} -U "${build_mirror}/" -B "${target_branch}") diff --git a/bin/buildpkg.in b/bin/buildpkg.in index d4f01bb..5a81593 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -111,8 +111,6 @@ prepare_build(){ [[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64' -# local mirrors_conf=${DATADIR}/pacman-mirrors.conf - mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -U "${build_mirror}/" -B "${target_branch}") mkchrootpkg_args+=(-r ${work_dir}) diff --git a/bin/chroot-run.in b/bin/chroot-run.in index b3c4d40..76a6404 100644 --- a/bin/chroot-run.in +++ b/bin/chroot-run.in @@ -30,7 +30,6 @@ usage() { echo ' options:' echo ' -C Location of a pacman config file' echo ' -M Location of a makepkg config file' - echo ' -S Location of a pacman-mirrors config file' echo ' -c Set pacman cache' echo ' -f Copy file from the host to the chroot' echo ' -s Do not run setarch' @@ -43,13 +42,12 @@ usage() { orig_argv=("$0" "$@") -opts='hC:M:S:c:r:w:f:s' +opts='hC:M:c:r:w:f:s' while getopts ${opts} arg; do case "${arg}" in C) pac_conf="$OPTARG" ;; M) makepkg_conf="$OPTARG" ;; - S) mirrors_conf="$OPTARG" ;; c) cache_dir="$OPTARG" ;; f) files+=("$OPTARG") ;; s) nosetarch=true ;; diff --git a/bin/mkchroot.in b/bin/mkchroot.in index 6303924..3d550d6 100644 --- a/bin/mkchroot.in +++ b/bin/mkchroot.in @@ -32,7 +32,6 @@ usage() { echo ' options:' echo ' -C Location of a pacman config file' echo ' -M Location of a makepkg config file' - echo ' -S Location of a pacman-mirrors config file' echo ' -B Set branch' echo ' -U Set a specific mirror' echo ' -c Set pacman cache' @@ -50,12 +49,11 @@ while getopts ${opts} arg; do case "${arg}" in C) pac_conf="$OPTARG" ;; M) makepkg_conf="$OPTARG" ;; -# S) mirrors_conf="$OPTARG" ;; + B) branch="$OPTARG" ;; + U) mirror="$OPTARG" ;; c) cache_dir="$OPTARG" ;; f) files+=("$OPTARG") ;; s) nosetarch=true ;; - B) branch="$OPTARG" ;; - U) mirror="$OPTARG" ;; h|?) usage ;; *) error "invalid argument '%s'" "$arg"; usage ;; esac diff --git a/lib/util-chroot.sh b/lib/util-chroot.sh index 881ff0c..fe82b40 100644 --- a/lib/util-chroot.sh +++ b/lib/util-chroot.sh @@ -18,16 +18,10 @@ copy_keyring(){ fi } -prepare_pac_mirrors(){ - mkdir -m 0755 -p $1/etc/pacman.d $1/var/lib/pacman-mirrors $1/usr/share/pacman-mirrors -# curl https://raw.githubusercontent.com/manjaro/pacman-mirrors/master/share/mirrors.json -o $1/usr/share/pacman-mirrors/mirrors.json - #curl https://raw.githubusercontent.com/manjaro/pacman-mirrors/master/conf/pacman-mirrors.conf -o $1/etc/pacman-mirrors.conf -# cp ${DATADIR}/pacman-mirrors.conf $1/etc -} - create_min_fs(){ msg "Creating install root at %s" "$1" mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,run,etc} + mkdir -m 0755 -p $1/etc/pacman.d $1/var/lib/pacman-mirrors $1/usr/share/pacman-mirrors mkdir -m 1777 -p $1/tmp mkdir -m 0555 -p $1/{sys,proc} }