From 7eadd1caa207c0e6aca81ba13258de2d321223fd Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Mon, 23 Sep 2024 20:46:52 +0200 Subject: [PATCH 1/3] repo check v2.0 Signed-off-by: Daniel Hansson --- menu/startup_configuration.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/menu/startup_configuration.sh b/menu/startup_configuration.sh index 2ce538a213..a3c6cfcc24 100644 --- a/menu/startup_configuration.sh +++ b/menu/startup_configuration.sh @@ -37,7 +37,12 @@ else fi # Get the correct apt-mirror -REPO=$(grep "URIs:" "$(find /etc/apt/ -type f -name "*sources*")" | grep http | awk '{print $2}' | head -1) +# Handle several sources +for source in "$(find /etc/apt/ -type f -name "*sources*")" +do + REPO=$(grep "URIs:" $source | grep http | awk '{print $2}' | head -1) +done +# Check if it matches if [ "$REPO" = 'http://archive.ubuntu.com/ubuntu' ] then MIRROR_SWITCH="ON" @@ -60,7 +65,7 @@ choice=$(whiptail --title "$TITLE" --checklist \ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "Keyboard Layout" "(Change the keyboard layout from '$KEYBOARD_LAYOUT')" "$KEYBOARD_LAYOUT_SWITCH" \ "Timezone" "(Change the timezone from $(cat /etc/timezone))" "$TIMEZONE_SWITCH" \ -"Locate Mirror" "(Change the apt repo for better download performance)" OFF 3>&1 1>&2 2>&3) +"Locate Mirror" "(Change the apt repo for better download performance)" "$MIRROR_SWITCH" 3>&1 1>&2 2>&3) case "$choice" in *"Keyboard Layout"*) From 6cf9cac1e3bbf853d82b4d6d44393848ddc3e354 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Mon, 23 Sep 2024 20:51:27 +0200 Subject: [PATCH 2/3] SC Signed-off-by: Daniel Hansson --- menu/startup_configuration.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/menu/startup_configuration.sh b/menu/startup_configuration.sh index a3c6cfcc24..2d97970836 100644 --- a/menu/startup_configuration.sh +++ b/menu/startup_configuration.sh @@ -38,7 +38,8 @@ fi # Get the correct apt-mirror # Handle several sources -for source in "$(find /etc/apt/ -type f -name "*sources*")" +FIND_SOURCES="$(find /etc/apt/ -type f -name "*sources*")" +for source in $FIND_SOURCES do REPO=$(grep "URIs:" $source | grep http | awk '{print $2}' | head -1) done From 82f29ea5ecd4497cc0c8fb7d67647d0266e567dd Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Mon, 23 Sep 2024 20:51:51 +0200 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Daniel Hansson --- menu/startup_configuration.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/startup_configuration.sh b/menu/startup_configuration.sh index 2d97970836..2711fe22ab 100644 --- a/menu/startup_configuration.sh +++ b/menu/startup_configuration.sh @@ -41,7 +41,7 @@ fi FIND_SOURCES="$(find /etc/apt/ -type f -name "*sources*")" for source in $FIND_SOURCES do - REPO=$(grep "URIs:" $source | grep http | awk '{print $2}' | head -1) + REPO=$(grep "URIs:" "$source" | grep http | awk '{print $2}' | head -1) done # Check if it matches if [ "$REPO" = 'http://archive.ubuntu.com/ubuntu' ]