Created
May 28, 2022 04:57
-
-
Save infertux/102a22d2794b1240a5ca2aad05d90eb8 to your computer and use it in GitHub Desktop.
Script to build Hockeypuck .deb package using Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
cd "$(dirname "$0")" | |
target="${1:-hockeypuck}" | |
interactive="${2:-}" | |
container=${target}-builder | |
volume=/root/HOST | |
channel=stable | |
docker pull debian:${channel} | |
[ "$(docker ps -qaf "name=${container}")" ] || docker run --name $container -d -t -v "${PWD}:${volume}" debian:${channel} | |
docker start $container | |
docker exec $container dpkg --configure -a | |
docker exec $container apt-get update | |
docker exec $container apt-get upgrade -y | |
docker exec $container apt-get install -y devscripts dh-exec vim quilt lintian | |
docker exec $container apt-get install -y -t ${channel} golang | |
docker exec $container apt-get autoremove -y --purge | |
docker exec $container go version | |
dir="${volume}/${target}" | |
package=${target#*/} | |
package="${package/-/_}*.deb" | |
if [ "$interactive" ] ; then | |
docker exec -ti $container /bin/bash | |
else | |
docker exec --workdir "$dir" $container git config --global --add safe.directory "$dir" # https://github.com/techknowlogick/xgo/issues/154 | |
docker exec --workdir "$dir" $container debuild -uc -us || docker exec -ti $container /bin/bash | |
docker exec --workdir "$dir" $container find .. -type f -name "$package" -exec lintian --info --pedantic {} \; | |
docker exec --workdir "$dir" $container find .. -type f -name "$package" -exec dpkg -c {} \; | |
docker exec --workdir "$dir" $container find .. -type f -name "$package" -exec ls -lh {} \; | |
docker exec --workdir "$dir" $container find .. -type f -name "$package" -exec sha256sum {} \; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment