Created
February 15, 2022 09:47
-
-
Save nicman23/8611376f3867641cbe3bcfa8b18e93f4 to your computer and use it in GitHub Desktop.
pkgbuild2_service.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aurpkg=proton-ge-custom | |
data="$(curl https://aur.archlinux.org/cgit/aur.git/tree/.SRCINFO\?h\=$aurpkg 2> /dev/null | grep source\ = | cut -f 2- -d =)" | |
( | |
echo '<services> | |
<service name="tar_scm"> | |
<param name="scm">git</param> | |
<param name="url">'"https://aur.archlinux.org/${aurpkg}.git"'</param> | |
</service>' | |
echo "$data" | grep git+http | while read l; do | |
echo ' <service name="tar_scm">'; | |
echo ' <param name="scm">git</param>' | |
if [ ! -z "$(grep \# <<< $l )" ]; then | |
revision=$(cut -f 2 -d \# <<< "$l") | |
echo ' <param name="url">'$(cut -f 2 -d+ <<< "$l" | cut -f 1 -d \#)'</param>' | |
case "$revision" in | |
commit*) rev="$(cut -f2 -d= <<< "$revision" )"; >&2;; | |
*) exit 2;; | |
esac | |
echo ' <param name="revision">'$rev'</param>' | |
else | |
echo ' <param name="url">'$(cut -f 2 -d+ <<< "$l")'</param>' | |
fi | |
echo ' </service>' | |
done | |
echo ' <service name="extract_file"> | |
<param name="archive">*.tar</param> | |
<param name="files">*/*</param> | |
</service>' | |
echo "$data" | grep \ http | while read L; do | |
echo ' <service name="download_url"> | |
<param name="host">'$(cut -f 3 -d / <<< $L)'</param> | |
<param name="protocol">https</param> | |
<param name="path">/'"$(cut -f 4- -d / <<< $L)"'</param> | |
</service>' | |
done | |
echo '</services>' | |
) > _service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment