first commit

This commit is contained in:
Mateusz Gruszczyński committed 2026-10-30 12:59:58 +01:00
commit 0efaae1715
27 files changed
+1455

No files matched your search

+147
View File
@@ -0,0 +1,147 @@
#!/usr/bin/env bash
set -Eeuo pipefail
source /opt/rustbox-package-builder/scripts/lib.sh
: "${SHA:?SHA required}"
: "${SRC:?SRC required}"
REPOSITORY="$DATA_DIR/repository"
APTLY_CONF="$DATA_DIR/state/aptly.conf"
OUT="$DATA_DIR/work/out"
PKG="$DATA_DIR/work/package"
rm -rf "$OUT" "$PKG"
mkdir -p "$OUT" "$DATA_DIR/packages/deb" "$DATA_DIR/packages/rpm/x86_64" "$DATA_DIR/packages/suse/x86_64"
VERSION=$(python3.11 - "$SRC/Cargo.toml" <<'PY'
import sys, tomllib
p=tomllib.load(open(sys.argv[1],'rb'))
print(p['package']['version'])
PY
)
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][A-Za-z0-9._-]+)?$ ]] || fatal "unsupported RustBox version: $VERSION"
SHORT_SHA=${SHA:0:12}
requested=${PACKAGE_RELEASE:-auto}
if [[ "$requested" == auto ]]; then
last_version=""; last_release=0
[[ -r "$DATA_DIR/state/last_version" ]] && last_version=$(cat "$DATA_DIR/state/last_version")
[[ -r "$DATA_DIR/state/last_package_release" ]] && last_release=$(cat "$DATA_DIR/state/last_package_release")
if [[ "$last_version" == "$VERSION" && "$last_release" =~ ^[0-9]+$ ]]; then
RELEASE=$((last_release + 1))
else
RELEASE=1
fi
else
[[ "$requested" =~ ^[1-9][0-9]*$ ]] || fatal "PACKAGE_RELEASE must be auto or a positive integer"
RELEASE=$requested
fi
cd "$SRC"
TOOLCHAIN=$(/opt/rustbox-package-builder/scripts/ensure-rust-toolchain.sh "$SRC")
log "building RustBox $VERSION-$RELEASE from $SHA with Rust $TOOLCHAIN"
[[ -f Cargo.lock ]] || fatal "Cargo.lock is required for reproducible packages"
if ! grep -q 'log_dir' src/config.rs || ! grep -q 'log_dir' src/main.rs; then
fatal "RustBox source must support native file logging through log_dir"
fi
case "${RUN_LINUX_TESTS:-compile}" in
0|off|false|no) log "cargo tests skipped" ;;
1|compile|check|no-run) cargo "+$TOOLCHAIN" test --release --locked --no-run ;;
full|run) cargo "+$TOOLCHAIN" test --release --locked ;;
*) fatal "RUN_LINUX_TESTS must be 0, compile, or full" ;;
esac
cargo "+$TOOLCHAIN" build --release --locked
BINARY="$CARGO_TARGET_DIR/release/rustbox"
[[ -x "$BINARY" ]] || fatal "built binary not found: $BINARY"
"$BINARY" --version
RUSTBOX_CONFIG=/opt/rustbox-package-builder/packaging/rustbox.toml "$BINARY" --check-config
MAX_GLIBC_FOUND=$(objdump -T "$BINARY" 2>/dev/null | grep -oE 'GLIBC_[0-9]+\.[0-9]+' | sed 's/^GLIBC_//' | sort -V | tail -n1 || true)
if [[ -n "$MAX_GLIBC_FOUND" ]]; then
newest=$(printf '%s\n%s\n' "$MAX_GLIBC_VERSION" "$MAX_GLIBC_FOUND" | sort -V | tail -n1)
[[ "$newest" == "$MAX_GLIBC_VERSION" ]] || fatal "binary requires GLIBC_$MAX_GLIBC_FOUND; configured maximum is GLIBC_$MAX_GLIBC_VERSION"
log "glibc compatibility: GLIBC_$MAX_GLIBC_FOUND or older"
fi
/opt/rustbox-package-builder/scripts/prepare-package.sh "$SRC" "$PKG" "$BINARY" "$VERSION" "$RELEASE"
DEB="$OUT/rustbox_${VERSION}-${RELEASE}_amd64.deb"
RPM="$OUT/rustbox-${VERSION}-${RELEASE}.x86_64.rpm"
SUSE="$OUT/rustbox-${VERSION}-${RELEASE}.suse.x86_64.rpm"
nfpm package --config "$PKG/nfpm-deb.yaml" --packager deb --target "$DEB"
nfpm package --config "$PKG/nfpm-rpm.yaml" --packager rpm --target "$RPM"
if [[ "${BUILD_SUSE:-1}" == 1 ]]; then
nfpm package --config "$PKG/nfpm-suse.yaml" --packager rpm --target "$SUSE"
fi
ar t "$DEB" | grep '^_gpgorigin$' >/dev/null || fatal "DEB package is not signed"
rpm -qpi "$RPM" | awk -F: '/^Signature/ && $0 !~ /\(none\)/ {ok=1} END{exit !ok}' || fatal "RPM package is not signed"
if [[ -f "$SUSE" ]]; then rpm -qpi "$SUSE" | awk -F: '/^Signature/ && $0 !~ /\(none\)/ {ok=1} END{exit !ok}' || fatal "SUSE RPM package is not signed"; fi
cp -f "$DEB" "$DATA_DIR/packages/deb/"
cp -f "$RPM" "$DATA_DIR/packages/rpm/x86_64/"
[[ -f "$SUSE" ]] && cp -f "$SUSE" "$DATA_DIR/packages/suse/x86_64/"
aptly -config="$APTLY_CONF" repo add -force-replace rustbox "$DEB" >/dev/null
SNAPSHOT="rustbox-${VERSION}-${SHORT_SHA}-$(date +%s)"
aptly -config="$APTLY_CONF" snapshot create "$SNAPSHOT" from repo rustbox >/dev/null
APT_SIGN=(-batch -gpg-key="$GPG_KEY_ID")
if aptly -config="$APTLY_CONF" publish list -raw | awk -v d="$REPO_DISTRIBUTION" '$2 == d {found=1} END{exit !found}'; then
aptly -config="$APTLY_CONF" publish switch -force-overwrite "${APT_SIGN[@]}" "$REPO_DISTRIBUTION" . "$SNAPSHOT" >/dev/null
else
aptly -config="$APTLY_CONF" publish snapshot -force-overwrite "${APT_SIGN[@]}" -distribution="$REPO_DISTRIBUTION" -component="$REPO_COMPONENT" -architectures=amd64 "$SNAPSHOT" >/dev/null
fi
APT_PUBLIC="$DATA_DIR/aptly/public"
[[ -f "$APT_PUBLIC/dists/$REPO_DISTRIBUTION/InRelease" ]] || fatal "APT InRelease missing"
RELEASE_ID="$(date -u '+%Y%m%dT%H%M%SZ')-${SHORT_SHA}"
RELEASE_DIR="$REPOSITORY/releases/$RELEASE_ID"
mkdir -p "$RELEASE_DIR/apt" "$RELEASE_DIR/rpm/x86_64" "$RELEASE_DIR/suse/x86_64"
rsync -a --delete "$APT_PUBLIC/" "$RELEASE_DIR/apt/"
rsync -a --delete "$DATA_DIR/packages/rpm/x86_64/" "$RELEASE_DIR/rpm/x86_64/"
if [[ "${BUILD_SUSE:-1}" == 1 ]]; then rsync -a --delete "$DATA_DIR/packages/suse/x86_64/" "$RELEASE_DIR/suse/x86_64/"; fi
for rpm_root in "$RELEASE_DIR/rpm/x86_64"; do
rm -rf "$rpm_root/repodata"; createrepo_c --update "$rpm_root" >/dev/null
done
if [[ "${BUILD_SUSE:-1}" == 1 ]]; then
rm -rf "$RELEASE_DIR/suse/x86_64/repodata"; createrepo_c --update "$RELEASE_DIR/suse/x86_64" >/dev/null
fi
GPG_SIGN=(--batch --yes --pinentry-mode loopback)
for rpm_root in "$RELEASE_DIR/rpm/x86_64"; do
gpg "${GPG_SIGN[@]}" --armor --detach-sign --local-user "$GPG_KEY_ID" --output "$rpm_root/repodata/repomd.xml.asc" "$rpm_root/repodata/repomd.xml"
done
if [[ "${BUILD_SUSE:-1}" == 1 ]]; then
gpg "${GPG_SIGN[@]}" --armor --detach-sign --local-user "$GPG_KEY_ID" --output "$RELEASE_DIR/suse/x86_64/repodata/repomd.xml.asc" "$RELEASE_DIR/suse/x86_64/repodata/repomd.xml"
fi
gpg --batch --armor --export "$GPG_KEY_ID" > "$RELEASE_DIR/repo-key.gpg"
BUILT_AT=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
cat > "$RELEASE_DIR/LINUX-BUILD-INFO.txt" <<INFO
app_version=$VERSION
package_release=$RELEASE
built_at=$BUILT_AT
packaging_revision=$PACKAGING_REVISION
source_url=$SOURCE_REPO
source_ref=$SOURCE_BRANCH
source_commit=$SHA
build_reason=source-or-packaging-change
INFO
if [[ "${BUILD_SUSE:-1}" == 1 ]]; then
cp "$RELEASE_DIR/LINUX-BUILD-INFO.txt" "$RELEASE_DIR/SUSE-BUILD-INFO.txt"
printf '%s\n' 'rpm_flavor=suse' >> "$RELEASE_DIR/SUSE-BUILD-INFO.txt"
else
: > "$RELEASE_DIR/SUSE-BUILD-INFO.txt"
fi
rm -f "$REPOSITORY/current.new"
ln -s "releases/$RELEASE_ID" "$REPOSITORY/current.new"
mv -Tf "$REPOSITORY/current.new" "$REPOSITORY/current"
printf '%s\n' "$SHA" | atomic_write "$DATA_DIR/state/last_commit"
printf '%s\n' "$VERSION" | atomic_write "$DATA_DIR/state/last_version"
printf '%s\n' "$RELEASE" | atomic_write "$DATA_DIR/state/last_package_release"
retention=${RELEASE_RETENTION:-10}
if [[ "$retention" =~ ^[1-9][0-9]*$ ]]; then
mapfile -t old < <(find "$REPOSITORY/releases" -mindepth 1 -maxdepth 1 -type d -printf '%T@ %p\n' | sort -nr | awk -v keep="$retention" 'NR>keep {$1=""; sub(/^ /,""); print}')
for dir in "${old[@]}"; do [[ "$dir" == "$RELEASE_DIR" ]] || rm -rf -- "$dir"; done
fi
log "published RustBox $VERSION-$RELEASE: $REPOSITORY_URL"
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -Eeuo pipefail
source /opt/rustbox-package-builder/scripts/lib.sh
WORK="$DATA_DIR/work/source"
REPOSITORY="$DATA_DIR/repository"
if [[ ! -d "$WORK/.git" ]]; then
rm -rf "$WORK"
git clone --no-tags "$SOURCE_REPO" "$WORK"
fi
cd "$WORK"
git remote set-url origin "$SOURCE_REPO"
git fetch --no-tags --prune origin "$SOURCE_BRANCH"
SHA=$(git rev-parse FETCH_HEAD)
CURRENT_SHA=""
CURRENT_REV=""
if [[ -r "$REPOSITORY/current/LINUX-BUILD-INFO.txt" ]]; then
CURRENT_SHA=$(sed -n 's/^source_commit=//p' "$REPOSITORY/current/LINUX-BUILD-INFO.txt" | head -n1)
CURRENT_REV=$(sed -n 's/^packaging_revision=//p' "$REPOSITORY/current/LINUX-BUILD-INFO.txt" | head -n1)
fi
if [[ "$CURRENT_SHA" == "$SHA" && "$CURRENT_REV" == "$PACKAGING_REVISION" ]]; then
log "no new RustBox build: commit=$SHA packaging_revision=$PACKAGING_REVISION"
exit 0
fi
git reset --hard "$SHA"
git clean -fdx
export SHA SRC="$WORK"
/opt/rustbox-package-builder/scripts/build-release.sh
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -Eeuo pipefail
SOURCE_DIR=${1:?usage: ensure-rust-toolchain.sh SOURCE_DIR}
[[ -r "$SOURCE_DIR/Cargo.toml" ]] || { echo "missing Cargo.toml: $SOURCE_DIR" >&2; exit 1; }
metadata=$(python3.11 - "$SOURCE_DIR" <<'PY'
import pathlib, re, sys, tomllib
root=pathlib.Path(sys.argv[1])
manifest=tomllib.loads((root/'Cargo.toml').read_text())
minimum=manifest.get('package',{}).get('rust-version','')
pinned=''
p=root/'rust-toolchain.toml'
if p.exists(): pinned=tomllib.loads(p.read_text()).get('toolchain',{}).get('channel','')
if minimum and not re.fullmatch(r'[0-9]+\.[0-9]+(?:\.[0-9]+)?', minimum): raise SystemExit('unsupported rust-version')
if pinned and not (pinned=='stable' or re.fullmatch(r'[0-9]+\.[0-9]+(?:\.[0-9]+)?', pinned)): raise SystemExit('unsupported rust-toolchain channel')
print(minimum)
print(pinned)
PY
)
mapfile -t requested <<< "$metadata"
minimum=${requested[0]:-}
channel=${requested[1]:-stable}
[[ -n "$channel" ]] || channel=stable
if ! rustup run "$channel" rustc --version >/dev/null 2>&1; then
echo "installing Rust toolchain $channel" >&2
rustup toolchain install "$channel" --profile minimal >&2
fi
installed=$(rustup run "$channel" rustc --version | awk '{print $2}')
if [[ -n "$minimum" ]]; then
lowest=$(printf '%s\n%s\n' "$installed" "$minimum" | sort -V | head -n1)
if [[ "$lowest" != "$minimum" ]]; then
echo "Rust $installed does not satisfy project MSRV $minimum" >&2
exit 1
fi
fi
printf '%s\n' "$channel"
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -Eeuo pipefail
source /opt/rustbox-package-builder/scripts/lib.sh
: "${SOURCE_REPO:?SOURCE_REPO required}"
: "${REPOSITORY_URL:?REPOSITORY_URL required}"
: "${SOURCE_BRANCH:=master}"
: "${POLL_INTERVAL:=300}"
: "${REPO_DISTRIBUTION:=stable}"
: "${REPO_COMPONENT:=main}"
: "${PACKAGE_RELEASE:=auto}"
: "${RUN_LINUX_TESTS:=compile}"
: "${MAX_GLIBC_VERSION:=2.34}"
: "${BUILD_SUSE:=1}"
: "${RELEASE_RETENTION:=10}"
export SOURCE_BRANCH POLL_INTERVAL REPO_DISTRIBUTION REPO_COMPONENT PACKAGE_RELEASE RUN_LINUX_TESTS MAX_GLIBC_VERSION BUILD_SUSE RELEASE_RETENTION
mkdir -p "$DATA_DIR"/{state,repository,work,cargo,packages} /tmp/rustbox-gnupg
chmod 0700 /tmp/rustbox-gnupg
export GNUPGHOME=/tmp/rustbox-gnupg
GPG_PRIVATE_KEY_FILE=/run/secrets/gpg/private-key.asc
[[ -s "$GPG_PRIVATE_KEY_FILE" ]] || fatal "missing GPG private key: $GPG_PRIVATE_KEY_FILE"
gpg --batch --import "$GPG_PRIVATE_KEY_FILE" >/dev/null 2>&1
GPG_KEY_ID=$(gpg --batch --with-colons --list-secret-keys | awk -F: '/^sec:/ {seen=1; next} seen && /^fpr:/ {print $10; exit}')
[[ -n "$GPG_KEY_ID" ]] || fatal "cannot resolve GPG signing key"
export GPG_PRIVATE_KEY_FILE GPG_KEY_ID
/opt/rustbox-package-builder/scripts/init-storage.sh
while true; do
if ! /opt/rustbox-package-builder/scripts/check-and-build.sh; then
log "build cycle failed; retrying after ${POLL_INTERVAL}s"
fi
sleep "$POLL_INTERVAL"
done
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -Eeuo pipefail
source /opt/rustbox-package-builder/scripts/lib.sh
APTLY_CONF="$DATA_DIR/state/aptly.conf"
APTLY_ROOT="$DATA_DIR/aptly"
REPOSITORY="$DATA_DIR/repository"
mkdir -p "$APTLY_ROOT" "$REPOSITORY/releases" "$DATA_DIR/packages/deb" "$DATA_DIR/packages/rpm/x86_64" "$DATA_DIR/packages/suse/x86_64"
cat > "$APTLY_CONF" <<JSON
{
"rootDir": "$APTLY_ROOT",
"architectures": ["amd64"],
"dependencyFollowSuggests": false,
"dependencyFollowRecommends": false,
"gpgDisableSign": false,
"gpgDisableVerify": false,
"gpgProvider": "gpg",
"skipLegacyPool": true
}
JSON
export APTLY_CONF
if ! aptly -config="$APTLY_CONF" repo list -raw | grep -Fx rustbox >/dev/null; then
aptly -config="$APTLY_CONF" repo create -distribution="$REPO_DISTRIBUTION" -component="$REPO_COMPONENT" rustbox >/dev/null
fi
for item in apt rpm suse repo-key.gpg LINUX-BUILD-INFO.txt SUSE-BUILD-INFO.txt; do
[[ ! -e "$REPOSITORY/$item" || -L "$REPOSITORY/$item" ]] || fatal "$REPOSITORY/$item exists and is not a symlink"
done
ln -sfn current/apt "$REPOSITORY/apt"
ln -sfn current/rpm "$REPOSITORY/rpm"
ln -sfn current/suse "$REPOSITORY/suse"
ln -sfn current/repo-key.gpg "$REPOSITORY/repo-key.gpg"
ln -sfn current/LINUX-BUILD-INFO.txt "$REPOSITORY/LINUX-BUILD-INFO.txt"
ln -sfn current/SUSE-BUILD-INFO.txt "$REPOSITORY/SUSE-BUILD-INFO.txt"
Executable
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -Eeuo pipefail
PACKAGING_REVISION=1
DATA_DIR=${DATA_DIR:-/var/lib/rustbox-package-builder}
log() { printf '%s %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$*"; }
fatal() { log "ERROR: $*" >&2; exit 1; }
require_cmd() { command -v "$1" >/dev/null 2>&1 || fatal "required command not found: $1"; }
yaml_quote() { python3 - "$1" <<'PY'
import json, sys
print(json.dumps(sys.argv[1]))
PY
}
atomic_write() { local path=$1 tmp="${path}.tmp.$$"; cat > "$tmp"; mv -f "$tmp" "$path"; }
+189
View File
@@ -0,0 +1,189 @@
#!/usr/bin/env bash
set -Eeuo pipefail
source /opt/rustbox-package-builder/scripts/lib.sh
SRC=${1:?source dir required}
PKG=${2:?package work dir required}
BINARY=${3:?binary path required}
VERSION=${4:?version required}
PACKAGE_RELEASE=${5:?release required}
rm -rf "$PKG"
mkdir -p "$PKG/payload/usr/local/bin" "$PKG/payload/usr/lib/systemd/system" "$PKG/payload/etc/rustbox" "$PKG/payload/etc/logrotate.d" "$PKG/scripts"
install -m 0755 "$BINARY" "$PKG/payload/usr/local/bin/rustbox"
install -m 0644 /opt/rustbox-package-builder/packaging/rustbox.service "$PKG/payload/usr/lib/systemd/system/rustbox.service"
install -m 0640 /opt/rustbox-package-builder/packaging/rustbox.toml "$PKG/payload/etc/rustbox/rustbox.toml"
install -m 0644 /opt/rustbox-package-builder/packaging/rustbox.logrotate "$PKG/payload/etc/logrotate.d/rustbox"
cat > "$PKG/scripts/deb-postinstall.sh" <<'SCRIPT'
#!/bin/sh
set -e
getent group rustbox >/dev/null 2>&1 || addgroup --system rustbox >/dev/null
if ! id rustbox >/dev/null 2>&1; then
adduser --system --ingroup rustbox --home /var/lib/rustbox --no-create-home --shell /usr/sbin/nologin rustbox >/dev/null
fi
install -d -o rustbox -g rustbox -m 0750 /etc/rustbox /var/log/rustbox
install -d -o rustbox -g rustbox -m 0700 /var/lib/rustbox
chown rustbox:rustbox /etc/rustbox/rustbox.toml
chmod 0640 /etc/rustbox/rustbox.toml
RUSTBOX_CONFIG=/etc/rustbox/rustbox.toml /usr/local/bin/rustbox --check-config
if command -v systemctl >/dev/null 2>&1; then
systemctl daemon-reload || true
systemctl enable rustbox.service >/dev/null 2>&1 || true
if [ -d /run/systemd/system ]; then systemctl restart rustbox.service || systemctl start rustbox.service || true; fi
fi
SCRIPT
cat > "$PKG/scripts/deb-preremove.sh" <<'SCRIPT'
#!/bin/sh
set -e
if [ "${1:-}" = remove ] && command -v systemctl >/dev/null 2>&1; then
systemctl disable --now rustbox.service >/dev/null 2>&1 || true
fi
SCRIPT
cat > "$PKG/scripts/deb-postremove.sh" <<'SCRIPT'
#!/bin/sh
set -e
command -v systemctl >/dev/null 2>&1 && systemctl daemon-reload >/dev/null 2>&1 || true
SCRIPT
cat > "$PKG/scripts/rpm-postinstall.sh" <<'SCRIPT'
#!/bin/sh
set -e
getent group rustbox >/dev/null 2>&1 || groupadd --system rustbox
if ! id rustbox >/dev/null 2>&1; then
NOLOGIN=/usr/sbin/nologin
[ -x "$NOLOGIN" ] || NOLOGIN=/sbin/nologin
useradd --system --gid rustbox --home-dir /var/lib/rustbox --no-create-home --shell "$NOLOGIN" rustbox
fi
install -d -o rustbox -g rustbox -m 0750 /etc/rustbox /var/log/rustbox
install -d -o rustbox -g rustbox -m 0700 /var/lib/rustbox
chown rustbox:rustbox /etc/rustbox/rustbox.toml
chmod 0640 /etc/rustbox/rustbox.toml
RUSTBOX_CONFIG=/etc/rustbox/rustbox.toml /usr/local/bin/rustbox --check-config
if command -v systemctl >/dev/null 2>&1; then
systemctl daemon-reload || true
systemctl enable rustbox.service >/dev/null 2>&1 || true
if [ -d /run/systemd/system ]; then systemctl restart rustbox.service || systemctl start rustbox.service || true; fi
fi
SCRIPT
cat > "$PKG/scripts/rpm-preremove.sh" <<'SCRIPT'
#!/bin/sh
set -e
if [ "${1:-1}" -eq 0 ] 2>/dev/null && command -v systemctl >/dev/null 2>&1; then
systemctl disable --now rustbox.service >/dev/null 2>&1 || true
fi
SCRIPT
cat > "$PKG/scripts/rpm-postremove.sh" <<'SCRIPT'
#!/bin/sh
set -e
command -v systemctl >/dev/null 2>&1 && systemctl daemon-reload >/dev/null 2>&1 || true
SCRIPT
chmod 0755 "$PKG/scripts"/*.sh
CONTENTS="$PKG/contents.yaml"
cat > "$CONTENTS" <<YAML
- src: $(yaml_quote "$PKG/payload/usr/local/bin/rustbox")
dst: /usr/local/bin/rustbox
file_info:
mode: 0755
- src: $(yaml_quote "$PKG/payload/usr/lib/systemd/system/rustbox.service")
dst: /usr/lib/systemd/system/rustbox.service
file_info:
mode: 0644
- src: $(yaml_quote "$PKG/payload/etc/rustbox/rustbox.toml")
dst: /etc/rustbox/rustbox.toml
type: config|noreplace
file_info:
mode: 0640
- src: $(yaml_quote "$PKG/payload/etc/logrotate.d/rustbox")
dst: /etc/logrotate.d/rustbox
type: config|noreplace
file_info:
mode: 0644
YAML
cat > "$PKG/nfpm-deb.yaml" <<YAML
name: rustbox
arch: amd64
platform: linux
version: $(yaml_quote "$VERSION")
release: "$PACKAGE_RELEASE"
section: mail
priority: optional
maintainer: "RustBox"
description: "RustBox webmail server"
license: "UNKNOWN"
contents:
$(cat "$CONTENTS")
depends:
- adduser
- ca-certificates
- gnupg
- libssl3 | libssl3t64
- logrotate
- systemd
scripts:
postinstall: $(yaml_quote "$PKG/scripts/deb-postinstall.sh")
preremove: $(yaml_quote "$PKG/scripts/deb-preremove.sh")
postremove: $(yaml_quote "$PKG/scripts/deb-postremove.sh")
deb:
compression: xz
signature:
key_file: $(yaml_quote "$GPG_PRIVATE_KEY_FILE")
type: origin
YAML
cat > "$PKG/nfpm-rpm.yaml" <<YAML
name: rustbox
arch: amd64
platform: linux
version: $(yaml_quote "$VERSION")
release: "$PACKAGE_RELEASE"
section: mail
priority: optional
maintainer: "RustBox"
description: "RustBox webmail server"
license: "UNKNOWN"
contents:
$(cat "$CONTENTS")
depends:
- ca-certificates
- gnupg2
- openssl-libs
- logrotate
- shadow-utils
- systemd
scripts:
postinstall: $(yaml_quote "$PKG/scripts/rpm-postinstall.sh")
preremove: $(yaml_quote "$PKG/scripts/rpm-preremove.sh")
postremove: $(yaml_quote "$PKG/scripts/rpm-postremove.sh")
rpm:
compression: zstd
signature:
key_file: $(yaml_quote "$GPG_PRIVATE_KEY_FILE")
YAML
cat > "$PKG/nfpm-suse.yaml" <<YAML
name: rustbox
arch: amd64
platform: linux
version: $(yaml_quote "$VERSION")
release: "$PACKAGE_RELEASE"
section: mail
priority: optional
maintainer: "RustBox"
description: "RustBox webmail server"
license: "UNKNOWN"
contents:
$(cat "$CONTENTS")
depends:
- ca-certificates
- gpg2
- libopenssl3
- logrotate
- shadow
- systemd
scripts:
postinstall: $(yaml_quote "$PKG/scripts/rpm-postinstall.sh")
preremove: $(yaml_quote "$PKG/scripts/rpm-preremove.sh")
postremove: $(yaml_quote "$PKG/scripts/rpm-postremove.sh")
rpm:
compression: gzip
signature:
key_file: $(yaml_quote "$GPG_PRIVATE_KEY_FILE")
YAML