v0.1.1
Go quality gates / test (push) Waiting to run

This commit is contained in:
Mateusz Gruszczyński committed 2026-11-30 14:44:28 +01:00
1 parent 8c4d463f1e
commit de13d851a8
75 files changed
+4656 -442

No files matched your search

+13 -7
View File
@@ -3,7 +3,7 @@
set -eu
ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
ARCH=${GOARCH:-amd64}
VERSION=${VERSION:-0.1.0}
VERSION=${VERSION:-0.1.1}
case "$ARCH" in
amd64|arm64) ;;
*) echo "Unsupported architecture: $ARCH (use amd64 or arm64)" >&2; exit 1 ;;
@@ -14,13 +14,19 @@ esac
STAGING=$(mktemp -d)
trap 'rm -rf "$STAGING"' EXIT HUP INT TERM
chmod 0755 "$STAGING"
mkdir -p "$STAGING/DEBIAN" "$STAGING/usr/bin" "$STAGING/lib/systemd/system" "$STAGING/etc/default" "$ROOT/dist"
mkdir -p "$STAGING/DEBIAN" "$STAGING/usr/bin" "$STAGING/lib/systemd/system" "$STAGING/etc/easydns-ui" "$ROOT/dist"
cd "$ROOT"
GOOS=linux GOARCH="$ARCH" CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION" -o "$STAGING/usr/bin/easydns-ui" ./cmd/easydns-ui
# Each build embeds its own fingerprint into the static asset filenames.
# The package release remains 0.1.1 unless the operator explicitly changes it.
BUILD_ID=${BUILD_ID:-$(date -u +%Y%m%dT%H%M%S)-$(od -An -N8 -tx1 /dev/urandom | tr -d ' \n')}
case "$BUILD_ID" in
''|*[!A-Za-z0-9._-]*) echo 'Invalid BUILD_ID' >&2; exit 1 ;;
esac
GOOS=linux GOARCH="$ARCH" CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X git.linuxiarz.pl/gru/EasyDNS-Web/internal/server.BuildID=$BUILD_ID" -o "$STAGING/usr/bin/easydns-ui" ./cmd/easydns-ui
chmod 0755 "$STAGING/usr/bin/easydns-ui"
cp packaging/easydns-ui.service "$STAGING/lib/systemd/system/easydns-ui.service"
cp packaging/easydns-ui.default "$STAGING/etc/default/easydns-ui"
chmod 0644 "$STAGING/etc/default/easydns-ui"
cp packaging/easydns-ui.toml "$STAGING/etc/easydns-ui/config.toml"
chmod 0640 "$STAGING/etc/easydns-ui/config.toml"
cp packaging/debian/postinst packaging/debian/prerm packaging/debian/postrm "$STAGING/DEBIAN/"
cat > "$STAGING/DEBIAN/control" <<CONTROL
Package: easydns-ui
@@ -32,11 +38,11 @@ Depends: adduser, coreutils, passwd
Maintainer: EasyDNS UI maintainers
Description: EasyDNS standalone OLED administration panel
A Go web UI for an existing EasyDNS server. Uses the server's
autogenerated control.token or local Unix control socket.
generated control.token, a protected TOML token, or Unix socket.
It does not install or replace the Rust DNS service.
CONTROL
cat > "$STAGING/DEBIAN/conffiles" <<CONF
/etc/default/easydns-ui
/etc/easydns-ui/config.toml
CONF
# The parent may be non-root while dpkg-deb is available.
OUT="$ROOT/dist/easydns-ui_${VERSION}_${ARCH}.deb"
+12 -4
View File
@@ -4,7 +4,8 @@ set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
IMAGE=${IMAGE:-golang:1.23-bookworm}
VERSION=${VERSION:-0.1.0}
BUILD_ID=${BUILD_ID:-}
VERSION=${VERSION:-0.1.1}
ARCH=${ARCH:-${GOARCH:-all}}
usage() {
@@ -16,8 +17,9 @@ on the host; Go, dpkg-deb, and cross-compilation tools run in the container.
Options:
--arch Architectures to build (default: all = amd64 + arm64)
--version Debian package version (default: 0.1.0)
--version Debian package version (default: 0.1.1)
--image Debian-based Go image (default: golang:1.23-bookworm)
--build-id Optional unique build stamp for hashed static filenames
-h, --help Show this message
Environment alternatives: ARCH, GOARCH, VERSION, IMAGE.
@@ -25,14 +27,14 @@ Packages are written to ./dist/easydns-ui_VERSION_ARCH.deb.
Examples:
./scripts/build_deb.sh
./scripts/build_deb.sh --arch amd64 --version 0.2.0
./scripts/build_deb.sh --arch amd64 --version 0.1.1
IMAGE=golang:1.23-bookworm ./scripts/build_deb.sh --arch arm64
HELP
}
while [ "$#" -gt 0 ]; do
case "$1" in
--arch|--version|--image)
--arch|--version|--image|--build-id)
option=$1
shift
if [ "$#" -eq 0 ]; then
@@ -44,6 +46,7 @@ while [ "$#" -gt 0 ]; do
--arch) ARCH=$1 ;;
--version) VERSION=$1 ;;
--image) IMAGE=$1 ;;
--build-id) BUILD_ID=$1 ;;
esac
;;
-h|--help) usage; exit 0 ;;
@@ -66,6 +69,10 @@ case "$VERSION" in
exit 2
;;
esac
case "$BUILD_ID" in
''|*[!A-Za-z0-9._-]*)
if [ -n "$BUILD_ID" ]; then echo "Invalid BUILD_ID" >&2; exit 2; fi ;;
esac
case "$IMAGE" in
''|*[!A-Za-z0-9._:/@-]*)
printf 'Invalid Docker image reference: %s\n' "$IMAGE" >&2
@@ -98,6 +105,7 @@ docker run --rm \
--volume "$ROOT:/workspace:rw" \
--workdir /workspace \
--env "VERSION=$VERSION" \
--env "BUILD_ID=$BUILD_ID" \
--env "ARCHES=$ARCHES" \
--env GOOS=linux \
--env CGO_ENABLED=0 \