install: Replace call to 'rev | cut' with 'grep' (#342)

This modifies the parsing of $release_name from $release_ver by
grepping for a semantic version with a '.tar.gz' extension.

The prior method used 'rev | cut | rev' to isolate $release_name
as the last field of $release_ver. The rev tool is not installed
by default on some machines.

Co-authored-by: Adam Gaia <git@agaia.dev>
This commit is contained in:
Adam Gaia
2022-06-28 15:52:50 +02:00
committed by GitHub
co-authored by Adam Gaia
parent 77f320cfc4
commit 17b205d233
+1 -1
View File
@@ -132,7 +132,7 @@ else
if [ "${next}" -eq 0 ]; then
release_ver=$(curl -L https://github.com/89luca89/distrobox/releases/latest |
grep 'refs/tags' | tail -1 | cut -d'"' -f2)
release_name=$(echo "${release_ver}" | rev | cut -d'/' -f1 | rev)
release_name=$(echo "${release_ver}" | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.tar\.gz$')
else
release_ver="89luca89/distrobox/archive/refs/heads/main.tar.gz"
release_name="main"