31 lines
860 B
Bash
31 lines
860 B
Bash
#!/bin/bash
|
|
|
|
# Function to get the date code and release date for a given package and version
|
|
get_date_code_and_release_date() {
|
|
package=${1:-"evolution"}
|
|
version=${2:-"3.38.3-1+deb11u2"}
|
|
|
|
# Construct the URL
|
|
url="https://snapshot.debian.org/mr/package/${package}/${version}/binfiles/${package}/${version}"
|
|
|
|
# Send a GET request to the API endpoint and parse the JSON response
|
|
hash=$(curl -s "${url}" | jq -r '.result[0].hash')
|
|
|
|
echo "${hash}"
|
|
|
|
# Construct the URL for the /file/<hash>/info endpoint
|
|
info_url="https://snapshot.debian.org/mr/file/${hash}/info"
|
|
|
|
echo "${info_url}"
|
|
|
|
# Send a GET request to the /file/<hash>/info endpoint and parse the JSON response
|
|
release_date=$(curl -s "${info_url}" | jq -r '.result[0].first_seen')
|
|
|
|
|
|
echo "RELEASE_DATE=${release_date}"
|
|
}
|
|
|
|
# Call the function
|
|
get_date_code_and_release_date "$@"
|
|
|