From 51fbc1f2cf11a5f7404b0953ed224160c20938ef Mon Sep 17 00:00:00 2001 From: Jocadbz Date: Fri, 21 Feb 2025 14:11:08 -0300 Subject: [PATCH] Add the ability to choose between different architectures --- install-stage1.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/install-stage1.sh b/install-stage1.sh index 9962911..156bc9b 100644 --- a/install-stage1.sh +++ b/install-stage1.sh @@ -210,12 +210,33 @@ xmirror #TODO: also remove CPU architecture TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)" -#TODO: select installation type -TARGET_TYPE="x86_64" + +options=("x86_64" "x86_64 musl" "x86_32") +while true; do + echo "Select your desired architecture." + for i in "${!options[@]}"; do + echo "$((i+1))) ${options[$i]}" + done + + read -p "Input your choice: " choice + + # Funny loop in bash... + if [[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 1 ] && [ "$choice" -le "${#options[@]}" ]; then + TARGET_TYPE="${options[$((choice-1))]}" + break + else + echo "Selection invalid." + fi +done + +echo "You selected: $TARGET_TYPE" #TODO: also add CPU architecture if grep "musl" <<< "$TARGET_TYPE"; then TARGET_MIRROR="$TARGET_MIRROR/musl" + # Probably not the smartest idea, but since there is just one option for musl, + # I figured out this should do. + TARGET_TYPE="x86_64" fi echo -n "Copying repository keys... "