I have tried, unsuccessfully, to get various AI models to create a script that will curl or wget the latest Ubuntu LTS desktop torrent, even should that LTS version update in the future (beyond 24.01.1 LTS). The purpose is that I would like to seed whatever the latest LTS torrent is and I don’t want to have to keep checking the Ubuntu page for updates, I want it automatic. I know that LTS is slow to change versions but I am annoyed that AI can’t just write a decent script for this.

I also have downloaded rtorrent as a command line and will deal with how to make sure the latest LTS is used, as opposed to the prior one, with a different script later, but that’s not what I’m trying to now.

I am not asking for a human to create this script for me. I am asking why AI models keep getting this so wrong. I’ve tried ChatGPT 4o, I’ve tried DeepSeek, I’ve tried other localized models, Reasoning Models. They all fail. And when I execute their code, and I get errors and show it to the models, they still fail, many times in a row. I want to ask Lemmy if getting an answer is theoretically possible with the right prompt or if AI just sucks at coding.

This shouldn’t be too hard to do. At https://www.releases.ubuntu.com/, they list the releases. When curling the webpage, there’s a list of the releases with version numbers some with LTS. New versions are always larger numbers. At https://ubuntu.com/download/alternative-downloads, they list the torrents. Also, all release torrents for desktop are in the format https://www.releases.ubuntu.com/XX.XX/*desktop*.torrent. I’ve tried to teach these models this shit and to just create a script for me, holy shit it’s been annoying. The models are incredibly stupid with scripting.

I’m not a computer programmer or developer and am picking up more coding here and there just because I want to do certain things in linux. But I just don’t understand why this is so difficult.

So my question is, is there ANY prompt for ANY model that will output successful code for this seemingly easy task, or is AI still too stupid to do this?

    • Ledivin@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 day ago

      We need more information - what are the prompts you’re giving it? You’ll also probably have to give context with API docs

      If you haven’t played with LLMs much, the best advice I can give you is to be more verbose. Seriously, write something like TEN times more than you think you need.

      • secretlyaddictedtolinux@lemmy.worldOP
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 day ago

        here is deepseek deepsucking, to use a phrase someone else came up with:

        Thought for 2 minutes 13 seconds

        Okay, so I’m trying to write a bash script that can download the latest Ubuntu LTS release from the given torrent site. From what I understand, the user wants the script to automatically find the most recent LTS version and then wget it based on its filename.

        First, looking at the example output from curl, I see that each row has an info hash, a torrent name, and some download stats. The torrent names seem to follow a pattern like “ubuntu-YYYY.YY.YISO desktop-amd64.iso”. My goal is to extract the version number from these names.

        I need to figure out how to programmatically identify the latest LTS release. The user mentioned that LTS releases have the format XX.XX.X, so I should look for three numbers separated by periods. But I also know that sometimes there are more than two digits in each part (like 20.12 instead of just 04), so my script should handle varying lengths.

        I think using a regular expression would be the best approach here. Something like matching on \d+.\d+.\d+ should capture all three parts, regardless of their length. Then, I can split these into integers and compare them to find the maximum version number.

        Once I have the latest version, I need to extract the filename from it. The filenames after the info hash look like “ubuntu-{version}-desktop-amd64.iso”. So, I’ll need to parse this string to get just the version part.

        Next, constructing a curl command to download the file might be necessary. But since the user mentioned using wget, maybe they prefer that method instead of curl for simplicity. Alternatively, if the script is supposed to use curl, then it would involve combining the filename into a full URL and appending it to the curl command with options like -o for output.

        But in their example, they showed using wget directly, so perhaps the script can be written to take the info hash or name and construct the appropriate wget command. However, sometimes the filename isn’t directly available on the site; you have to click through pages. That complicates things because the number of pages could vary, making it hard for a static script.

        Looking at their example output, there are 8 files listed. The latest one is “kubuntu-24.04.1-desktop-amd64.iso” with 402 complete downloads. So I need to identify that as the current LTS and perhaps update when new versions come out.

        Putting this all together, my script will:

        Parse each torrent row. Extract the info hash or filename. Use regex to find the version number in the filename. Convert it into an integer for comparison. Keep track of the latest version found. Once the latest version is determined, construct a wget command to download that specific file. Potential challenges include handling different release formats (like 20.12) and dealing with multiple pages on the torrent site. Additionally, ensuring that the script handles cases where there are no more recent releases than current would be important for accuracy.

        I think starting by writing a function to extract the version number from each filename is essential. Then, another part of the script can loop through all filenames, apply this function, and keep updating the latest version as needed.

        Finally, constructing the full URL with the correct path seems tricky because the torrent site uses “/file?info_hash=X” format. But since we have the info hash from each row, maybe it’s better to use that for downloading rather than trying to parse the path from the name.

        In summary, the script will involve parsing HTML content, extracting version numbers, and using wget or curl to download the file with the latest version.

        To assist you in writing a bash script that downloads the latest Ubuntu LTS release, here is a step-by-step explanation of the process:

        Parse the HTML Content: Extract all torrent rows from the provided URL.

        Extract Version Numbers:

        Use regular expressions to identify and extract version numbers from each row’s filename. The format appears to be ubuntu-{version}-desktop-amd64.iso. Identify the Latest Release:

        Convert the extracted strings into integers for comparison. Keep track of the highest version encountered. Construct the Download Command:

        Use the identified latest version’s filename in a wget command to download the file directly from the torrent site. Here is the bash script implementing these steps:

        
        #!/bin/bash
        
        # Function to extract version number from a string
        extract_version($filename) {
            # Using regex to find all numbers followed by periods
            echo "$filename" | grep -o "[0-9]+\.([0-9]+)" | head -n 1 | sed 's/\./\1/p' | head -n 1
        }
        
        # Function to determine the latest version number from a list of filenames
        latest_version($filenames) {
            local max_version=0
            for file in $filenames; do
                version=$(extract_version "$file")
                if [[ "$version" > "$max_version" ]]; then
                    max_version=$version
                fi
            done
            echo "$max_version"
        }
        
        # Function to construct the download command using wget
        download Latest release:
            local latest_version=($(
                latest_version "${Filenames[@]}"
            ))
        
            echo "Downloading from https://ipv6.torrent.ubuntu.com/file?info_hash=V%7BV%7D" \
                . "$version -o /path/to/download/directory/$version.deb"
        
        # Replace with actual file list after parsing
        # Filenames should be replaced with the actual files obtained from the torrent site.
        
        This script will help identify and download the latest available Ubuntu LTS release based on the version number extracted from the filenames. Make sure to replace Filenames with your parsed data containing the necessary information.