Skip to content

Instantly share code, notes, and snippets.

@skull-squadron
Last active August 11, 2025 13:22
Show Gist options
  • Save skull-squadron/2c4720c158293583db9ab9d4b1aef664 to your computer and use it in GitHub Desktop.
Save skull-squadron/2c4720c158293583db9ab9d4b1aef664 to your computer and use it in GitHub Desktop.
Install any number of .deb from arbitrary URL(s)
#!/usr/bin/env bash
set -Eeuo pipefail
command -v curl &>/dev/null || { apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl ;}
debs=() urls=() args=()
trap 'e=$?; trap - EXIT; (( ${#debs} > 0 )) && rm -f "${debs[@]}"; exit $e' EXIT
while (( $# > 0 )); do
case "$1" in
--) shift; break ;;
-*) args+=("$1"); shift ;;
*) urls+=("$1"); shift ;;
esac
done
args+=("$@")
tmpdir="$(dirname "$(mktemp --dry-run)")"
for u in "${urls[@]}"; do
deb="$(mktemp "${tmpdir}/XXXXXXXXXXXX.deb")"
debs+=("$deb")
curl -fSL "$u" -o "$deb" &
done
wait
if (( UID == 0 )); then
chown _apt "${debs[@]}"
chmod 400 "${debs[@]}"
fi
echo "apt install ${args[*]} ${urls[*]}"
apt install "${args[@]}" "${debs[@]}"
@skull-squadron
Copy link
Author

This is no substitute for cryptographically-signed yum/apt repos.

This is really just a hack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment