From b7b3d9c5293e3e1138884e77da21a9a3aa9a3e64 Mon Sep 17 00:00:00 2001 From: oddlama Date: Thu, 26 Nov 2020 12:44:59 +0100 Subject: [PATCH] Added mirrorselect switch and mirrorselect large file switch. Closes #3 --- scripts/config.sh | 9 +++++++++ scripts/main.sh | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/config.sh b/scripts/config.sh index 76069d5..8f7d4b6 100644 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -176,6 +176,15 @@ STAGE3_BASENAME="stage3-$GENTOO_ARCH-systemd" #STAGE3_BASENAME="stage3-$GENTOO_ARCH-hardened+nomultilib" #STAGE3_BASENAME="stage3-$GENTOO_ARCH-hardened-selinux+nomultilib" +# If set to true, the best best gentoo mirrors will be selected +# automatically by app-portage/mirrorselect +SELECT_MIRRORS=true + +# If set to true, mirrorselect will download a large 100kb file +# from each mirror for more accurate test results. This can +# take significantly longer (~5-10min). +SELECT_MIRRORS_LARGE_FILE=false + # Set to true if the tarball is based on systemd. In this case # we need to use slightly different utilities to setup the base system. SYSTEMD=true diff --git a/scripts/main.sh b/scripts/main.sh index 2e06cc6..c3cc0b7 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -120,15 +120,20 @@ configure_portage() { mkdir_or_die 0755 "/etc/portage/package.keywords" touch_or_die 0644 "/etc/portage/package.keywords/zz-autounmask" - einfo "Temporarily installing mirrorselect" - try emerge --verbose --oneshot app-portage/mirrorselect + if [[ $SELECT_MIRRORS == "true" ]]; then + einfo "Temporarily installing mirrorselect" + try emerge --verbose --oneshot app-portage/mirrorselect - einfo "Selecting fastest portage mirrors" - try mirrorselect -s 4 -b 10 -D + einfo "Selecting fastest portage mirrors" + mirrorselect_params=("-s" "4" "-b" "10") + [[ $SELECT_MIRRORS_LARGE_FILE == "true" ]] \ + && mirrorselect_params+=("-D") + try mirrorselect "${mirrorselect_params[@]}" - einfo "Adding ~$GENTOO_ARCH to ACCEPT_KEYWORDS" - echo "ACCEPT_KEYWORDS=\"~$GENTOO_ARCH\"" >> /etc/portage/make.conf \ - || die "Could not modify /etc/portage/make.conf" + einfo "Adding ~$GENTOO_ARCH to ACCEPT_KEYWORDS" + echo "ACCEPT_KEYWORDS=\"~$GENTOO_ARCH\"" >> /etc/portage/make.conf \ + || die "Could not modify /etc/portage/make.conf" + fi } install_sshd() {