端末からgithubから最新のdebパッケージをダウンロードしてインストールします。

端末からgithubから最新のdebパッケージをダウンロードしてインストールします。

最新バージョンをダウンロードしてインストールしたいです。.deb-githubのパッケージ(https://github.com/elbersb/otr-verwaltung/downloads正確には)。

githubのスクリプトを使用して最新のパッケージ(例:*otrverwaltung_0.9.1_all.deb*)を自動的にダウンロードするにはどうすればよいですか?

私が今まで試したこと:

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

ベストアンサー1

# 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"

おすすめ記事