3

I would like to download and install the latest .deb-package from github (https://github.com/elbersb/otr-verwaltung/downloads to be exact).

How can I download the latest package (e.g. *otrverwaltung_0.9.1_all.deb*) automatically with a script from github?

What I have tried so far:

wget -O- -q --no-check-certificate https://github.com/elbersb/otr-verwaltung/downloads | grep -o -l -e 'otrverwaltung_[0-9.]*_all.deb'
#The filename should be saved in a variable OTRPACKAGE
sudo dpkg -i OTRPACKAGE

2 Answers 2

2
# Find the URL of the .deb file
url=$(wget -O- -q --no-check-certificate https://github.com/elbersb/otr-verwaltung/downloads |
       sed -ne 's/^.*"\([^"]*otrverwaltung_[^"]*_all\.deb\)".*/\1/p')
case $url in
  http://*|https://*) :;;
  /*) url=https://github.com$url;;
  *) url=https://github.com/elbersb/otr-verwaltung/$url;;
esac
# Create a temporary directory
dir=$(mktemp -dt)
cd "$dir"
# Download the .deb file
wget "$url"
# Install the package
sudo dpkg -i "${url##*/}"
# Clean up
rm "${url##*/}"
cd /
rmdir "$dir"
-5

deb-get can do this for many popular applications and if yours is not yet in the repository you could add it yourself.

1
  • Just like for your other virtually identical answer: It is not enough to say what tool to use, you also need to show how to use it to solve the user's issue.
    – Kusalananda
    Dec 21, 2022 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .