Add the ability to choose between different architectures

master
Joca 2025-02-21 14:11:08 -03:00
parent 0facbea16a
commit 51fbc1f2cf
Signed by: jocadbz
GPG Key ID: B1836DCE2F50BDF7
1 changed files with 23 additions and 2 deletions

View File

@ -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... "