instalee/handlers/apt/install_deb

16 lines
560 B
Plaintext
Raw Normal View History

2022-11-24 14:03:57 +00:00
#!/bin/sh -e
# Install a package from a local or downloaded .deb-file and remove it
2022-11-24 14:03:57 +00:00
# Can also infer a latest github release
loc="$(basename "$1")"
case "$1" in
2022-11-24 14:03:57 +00:00
(http*) wget --no-verbose -O "$loc" "$@";;
(*.deb) loc="$1";;
(git*) domain="$1"; shift
result=$(curl -s "https://api.$domain/repos/$1/$2/releases/latest" | grep -o "http.*${3:-deb}" | awk '{ print length(), $0}' | sort -n | cut -d' ' -f2-)
"$0" $(echo "$result" | command grep amd64 | head -1 || echo "$result")
exit $?;;
esac
sudo dpkg -i "$loc"
2022-12-16 18:43:58 +00:00
sudo apt-get -f install
2022-09-09 22:05:02 +00:00
sudo rm -v "$loc"