Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bootable-usb): add Fedora #699

Closed
wants to merge 14 commits into from
Closed
25 changes: 22 additions & 3 deletions core/tabs/utils/create-bootable-usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ fetch_debian_latest_iso() {
printf "%b\n" "${GREEN} Selected Debian Linux (latest) ISO URL: ${RC} $DEBIAN_URL"
}

fetch_fedora_latest_iso() {
FEDORA_URL=$(curl -s 'https://www.fedoraproject.org/releases.json' |
grep -o '"link": "[^"]*' |
sed -e 's/"link": "//' |
awk -v version="40" -v arch="x86_64" -v variant="Workstation" ' BEGIN { FS="," }
{
if ($0 ~ version && $0 ~ arch && $0 ~ variant && $0 ~ "Live-x86_64") {
print $0
}
}' |
head -n 1)
printf "%b\n" "${GREEN} Selected Fedora Workstation (latest) ISO URL: ${RC} $FEDORA_URL"
lennartpj marked this conversation as resolved.
Show resolved Hide resolved
}

# Function to ask whether to use local or online ISO
choose_iso_source() {
printf "%b\n" "${YELLOW} Do you want to use a local ISO or download online? ${RC}"
Expand Down Expand Up @@ -101,8 +115,9 @@ fetch_iso_urls() {
printf "%b\n" "1) Arch Linux (latest)"
printf "%b\n" "2) Arch Linux (older versions)"
printf "%b\n" "3) Debian Linux (latest)"
printf "%b\n" "4) Fedora 40 Workstation (latest)"
printf "\n"
printf "%b" "Select the ISO you want to download (1-3): "
printf "%b" "Select the ISO you want to download (1-4): "
read -r ISO_OPTION

case $ISO_OPTION in
Expand All @@ -118,6 +133,10 @@ fetch_iso_urls() {
fetch_debian_latest_iso
ISO_URL=$DEBIAN_URL
;;
4)
fetch_fedora_latest_iso
ISO_URL=$FEDORA_URL
;;
*)
printf "%b\n" "${RED}Invalid option selected.${RC}"
exit 1
Expand Down Expand Up @@ -157,7 +176,7 @@ write_iso(){
printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}"
read -r CONFIRMATION

if [ "$CONFIRMATION" != "yes" ]; then
if [ "$(echo "$CONFIRMATION" | tr '[:upper:]' '[:lower:]')" != "yes" ] && [ "$(echo "$CONFIRMATION" | tr '[:upper:]' '[:lower:]')" != "y" ]; then
printf "%b\n" "${YELLOW}Operation cancelled.${RC}"
exit 1
fi
Expand Down Expand Up @@ -191,4 +210,4 @@ write_iso(){

checkEnv
checkEscalationTool
write_iso
write_iso
1 change: 1 addition & 0 deletions docs/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- **Wifi Control**: Controls WiFi settings.
- **Numlock Control**: Sets up Numlock on boot.
- **Bluetooth Control**: Controls Bluetooth settings.
- **Create Bootable USB**: Makes a USB Stick that can be used to install the selected Linux distribution.

### Monitor control

Expand Down