diff --git a/bin/basestrap.in b/bin/basestrap.in index 9e2077f..8fe5dfb 100644 --- a/bin/basestrap.in +++ b/bin/basestrap.in @@ -31,7 +31,7 @@ branch=stable usage() { echo "usage: ${0##*/} [options] root [packages...]" echo " -C Use an alternate config file for pacman" - echo " -P Use an alternate config file for pacman-mirrors" + 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" @@ -55,12 +55,12 @@ usage() { orig_argv=("$0" "$@") -opts=':C:P:cdGiM:B:U' +opts=':C:S:B:U:cdGiM' while getopts ${opts} arg; do case "${arg}" in C) pacman_config=$OPTARG ;; - P) mirrors_conf="$OPTARG" ;; + S) mirrors_conf="$OPTARG" ;; d) directory=true ;; c) hostcache=true ;; i) interactive=true ;; @@ -85,7 +85,6 @@ ${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg") ${interactive} && pacman_args+=(--noconfirm) [[ -n $pacman_config ]] && pacman_args+=(--config="$pacman_config") -[[ -n $mirrors_conf ]] && cp ${mirrors_conf} "$newroot/etc/pacman-mirrors.conf" [[ -d $newroot ]] || die "%s is not a directory" "$newroot" @@ -93,20 +92,24 @@ 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}" -R) +pm_args=(-a -R -p "$newroot" -S "${branch}") -[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}" -n) +[[ -n ${mirror} ]] && pm_args+=(-n -U "${mirror}") +info "pm_args: %s" "${pm_args[*]}" # create obligatory directories create_min_fs "$newroot" +if [[ -n $mirrors_conf ]]; then + cp ${mirrors_conf} "$newroot/etc/pacman-mirrors.conf" +fi + info "Configuring pacman-mirrors: %s" "${branch}" pacman-mirrors "${pm_args[@]}" @@ -125,4 +128,3 @@ fi if ${copymirrorlist};then copy_mirrorlist "$newroot" fi - diff --git a/bin/buildiso.in b/bin/buildiso.in index dfde0db..9c46077 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -45,7 +45,7 @@ prepare_build(){ iso_file=$(gen_iso_fn).iso - mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -U "${build_mirror}" -B "${target_branch}") + mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -U "${build_mirror}/" -B "${target_branch}") work_dir=${chroots_iso}/${profile}/${target_arch} iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}" @@ -141,7 +141,7 @@ iso_only=false verbose=false persist=false -mkchroot_args=(-L) +mkchroot_args=() usage() { echo "Usage: ${0##*/} [options]" diff --git a/bin/buildpkg.in b/bin/buildpkg.in index deb5050..2f400d4 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -89,7 +89,7 @@ sign=false udev_root=false is_multilib=false -mkchroot_args=(-L) +mkchroot_args=() mkchrootpkg_args=() install_pkgs=() @@ -113,7 +113,7 @@ prepare_build(){ local mirrors_conf=${DATADIR}/pacman-mirrors.conf - mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -U ${build_mirror} -B "${target_branch}") + mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -U "${build_mirror}/" -B "${target_branch}") mkchrootpkg_args+=(-r ${work_dir}) diff --git a/bin/mkchroot.in b/bin/mkchroot.in index 772527f..cfebcac 100644 --- a/bin/mkchroot.in +++ b/bin/mkchroot.in @@ -44,7 +44,7 @@ usage() { orig_argv=("$0" "$@") -opts='hC:M:S:c:f:s:U:B' +opts='hC:M:S:U:B:c:f:s' while getopts ${opts} arg; do case "${arg}" in @@ -100,7 +100,7 @@ for file in "${files[@]}"; do cp "$file" "$working_dir$file" done -basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} ${cache_dirs[@]/#/--cachedir=} -B ${branch:+-"$branch"} ${mirrors_conf:+-P "$mirrors_conf"}) +basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}" -S "$mirrors_conf") [[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}") @@ -109,8 +109,7 @@ while read -r varname; do _env+=("$varname=${!varname}") done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$') env -i "${_env[@]}" \ - -basestrap "${basestrap_args[@]}" "$working_dir" "$@" || die 'Failed to install all packages' +basestrap "${basestrap_args[@]}" "$working_dir" ${cache_dirs[@]/#/--cachedir=} "$@" || die 'Failed to install all packages' echo "$version" > "$working_dir/.manjaro-tools" @@ -120,4 +119,3 @@ ${nosetarch} && chroot_args+=(${nosetarch:+-s}) exec chroot-run \ ${chroot_args[*]} \ "$working_dir" locale-gen - diff --git a/lib/util-chroot.sh b/lib/util-chroot.sh index 9947de0..f2d6452 100644 --- a/lib/util-chroot.sh +++ b/lib/util-chroot.sh @@ -20,7 +20,7 @@ copy_keyring(){ 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/var/{cache/pacman/pkg,lib/{pacman,log,pacman-mirrors}} $1/{dev,run,etc/pacman.d} mkdir -m 1777 -p $1/tmp mkdir -m 0555 -p $1/{sys,proc} }