fix(quickget): remove use of grep -P and replace with portable equivalent

This commit is contained in:
Martin Wimpress 2024-05-21 23:26:05 -04:00 committed by Martin Wimpress
parent 7f250ed1b0
commit 590bd560cb
1 changed files with 5 additions and 5 deletions

View File

@ -742,7 +742,7 @@ function releases_elementary() {
function releases_endeavouros() { function releases_endeavouros() {
local ENDEAVOUR_RELEASES="" local ENDEAVOUR_RELEASES=""
ENDEAVOUR_RELEASES="$(web_pipe "https://mirror.alpix.eu/endeavouros/iso/" | LC_ALL="en_US.UTF-8" sort -Mr | grep -o -P '(?<=<a href=").*(?=.iso">)' | grep -v 'x86_64' | cut -c 13- | head -n 5 | tr '\n' ' ')" ENDEAVOUR_RELEASES="$(web_pipe "https://mirror.alpix.eu/endeavouros/iso/" | grep -o '<a href="[^"]*.iso">' | sed 's/^<a href="//;s/.iso">.*//' | grep -v 'x86_64' | LC_ALL="en_US.UTF-8" sort -Mr | cut -c 13- | head -n 5 | tr '\n' ' ')"
echo "${ENDEAVOUR_RELEASES,,}" echo "${ENDEAVOUR_RELEASES,,}"
} }
@ -804,7 +804,7 @@ function editions_ghostbsd() {
function releases_gnomeos() { function releases_gnomeos() {
#shellcheck disable=SC2046,SC2005 #shellcheck disable=SC2046,SC2005
echo "nightly" $(web_pipe "https://download.gnome.org/gnomeos/" | grep -o -P '(?<=<a href=").*(?=/" title=")' | sort -nr) echo "nightly" $(web_pipe "https://download.gnome.org/gnomeos/" | grep "title=" | awk -F'"' '{print $4}' | tr -d '/' | sort -nr)
} }
function releases_guix() { function releases_guix() {
@ -1702,7 +1702,7 @@ function get_cachyos() {
local HASH="" local HASH=""
local REL="" local REL=""
local URL="https://mirror.cachyos.org/ISO/${EDITION}/" local URL="https://mirror.cachyos.org/ISO/${EDITION}/"
REL=$(web_pipe "${URL}" | grep -Po '(?<=">)[0-9]+(?=/</a>)' | sort -ru | tail -n 1) REL=$(web_pipe "${URL}" | grep -o '>[0-9]*/</a>' | grep -o '[0-9]*' | sort -ru | tail -n 1)
local ISO="cachyos-${EDITION}-linux-${REL}.iso" local ISO="cachyos-${EDITION}-linux-${REL}.iso"
HASH=$(web_pipe "${URL}/${REL}/${ISO}.sha256" | cut -d' ' -f1) HASH=$(web_pipe "${URL}/${REL}/${ISO}.sha256" | cut -d' ' -f1)
echo "${URL}/${REL}/${ISO} ${HASH}" echo "${URL}/${REL}/${ISO} ${HASH}"
@ -1822,7 +1822,7 @@ function get_endeavouros() {
local ISO="" local ISO=""
local URL="https://mirror.alpix.eu/endeavouros/iso" local URL="https://mirror.alpix.eu/endeavouros/iso"
# Find EndeavourOS releases from mirror, pick one matching release # Find EndeavourOS releases from mirror, pick one matching release
ENDEAVOUR_RELEASES="$(web_pipe "${URL}/" | grep -o -P '(?<=<a href=").*(?=.iso">)' | grep -v 'x86_64')" ENDEAVOUR_RELEASES="$(web_pipe "${URL}/" | grep -o '<a href="[^"]*.iso">' | sed 's/^<a href="//;s/.iso">.*//' | grep -v 'x86_64')"
ISO="$(echo "${ENDEAVOUR_RELEASES}" | grep -i "${RELEASE}").iso" ISO="$(echo "${ENDEAVOUR_RELEASES}" | grep -i "${RELEASE}").iso"
HASH=$(web_pipe "${URL}/${ISO}.sha512sum" | cut -d' ' -f1) HASH=$(web_pipe "${URL}/${ISO}.sha512sum" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}" echo "${URL}/${ISO} ${HASH}"
@ -1953,7 +1953,7 @@ function get_haiku() {
function get_holoiso() { function get_holoiso() {
local HASH="" local HASH=""
local URL="" local URL=""
URL=$(web_pipe "https://api.github.com/repos/HoloISO/releases/releases" | jq ".[] | select(.tag_name==\"${RELEASE}\") | .body" | grep -Po "https://\S+holoiso.ru.eu.org/\S+.iso" | head -n 1) URL=$(web_pipe "https://api.github.com/repos/HoloISO/releases/releases" | jq -r ".[] | select(.tag_name==\"${RELEASE}\") | .body" | sed -n 's/.*\(https:\/\/[^ ]*holoiso\.ru\.eu\.org\/[^ ]*\.iso\).*/\1/p' | head -n 1)
echo "${URL} ${HASH}" echo "${URL} ${HASH}"
} }