installing software from the latest GitHub software release
Attention
This is a suboptimal solution, relying on the assumption that the filenames of 64-bit .deb releases will contain 64.deb or 64-bit.deb. It is not certain to work.
Attention
A software file and a text file (islGHsr-log.txt) will be saved to the current directory.
For 64-bit .deb releases, use curl -s https://api.github.com/repos/foo/bar/releases/latest | jq -r '.assets[].browser_download_url' | grep '64.deb\|64-bit.deb' | xargs -n1 wget | tee ./islGHsr-log.txt && <./islGHsr-log.txt grep 'Saving to' | sed 's/^............//' | sed 's/.$//' | xargs -n1 sudo dpkg -i, where foo/bar is the username and repository name.
Bug
sed 's/^............//' is used instead of cut -cfoobar (where foobar is the number of characters to be removed from the beginning of the string) because cut does not properly handle UTF-8 characters.
examples
| software | repository |
|---|---|
| Brackets | https://github.com/adobe/brackets |
| Pandoc1 | https://github.com/jgm/pandoc |
explanation
Note
This is an incomplete explanation.
curl -s https://api.github.com/repos/foo/bar/releases/latest | jq -r '.assets[].browser_download_url' | grep '64.deb\|64-bit.deb'usually (but not always) gets the URL of the software file to be downloaded.-
grep '64.deb\|64-bit.deb'uses the regular expression alternation operator to return lines containing64.debor64-bit.deb.
islGHsr-log.txtcontains the log messages of wget.
licensing
No rights reserved: CC0 1.0.
prior work
- The
-scURL option was introduced to me by an answer on Stack Overflow by Putna. - The basic method of using jq to select a URL from a GitHub JSON file was introduced to me by an answer on Stack Overflow by IanB.
- The correct way of selecting from multiple arrays with jq was introduced to me by an answer on Stack Overflow by hek2mgl.
- The method of using sed to remove the first 12 characters from a string was introduced to me by an answer on Stack Overflow by Phil.
- The necessity of using a backslash-escape with the regular expression alternation operator was introduced to me by an answer on Stack Exchange by Gilles.
- The possibility of using xargs to make standard output into an option for another program was introduced to me by an answer on Stack Overflow by Kyle Jones and a post on Ubuntu Forums by llamakc.
-
http://pandoc.org/installing.html ↩