From 158c6006b1cb06710a2bdde6e298bc71fc49f036 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Sun, 17 Mar 2024 21:34:06 +0000 Subject: [PATCH] build(opensuse): improve opensuse build process. --- Makefile | 4 ++-- dists/build.sh | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e840c063..cce0f644 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ full: build ROOT = $(shell find "${BUILD}/root" -type f -printf "%P\n") PROFILES = $(shell find "${BUILD}/apparmor.d" -type f -printf "%P\n") install: - @install -Dm755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log + @install -Dm0755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log @for file in ${ROOT}; do \ install -Dm0644 "${BUILD}/root/$${file}" "${DESTDIR}/$${file}"; \ done; @@ -78,7 +78,7 @@ dpkg: rpm: @bash dists/build.sh rpm - @sudo rpm -i ${PKGNAME}-*.rpm + @sudo rpm -ivh --force ${PKGNAME}-*.rpm tests: @go test ./cmd/... -v -cover -coverprofile=coverage.out diff --git a/dists/build.sh b/dists/build.sh index 5199d23f..8cc1f82c 100644 --- a/dists/build.sh +++ b/dists/build.sh @@ -8,7 +8,8 @@ set -eu -o pipefail readonly COMMAND="$1" -readonly OUTPUT="${PKGDEST:-$PWD}" +readonly OUTPUT="$PWD" +readonly PKGDEST="${PKGDEST:-$PWD}" readonly PKGNAME=apparmor.d VERSION="0.$(git rev-list --count HEAD)" readonly VERSION @@ -27,7 +28,7 @@ main() { ;; rpm) - RPMBUILD_ROOT=$(mktemp -d) + RPMBUILD_ROOT=$(mktemp -d /tmp/$PKGNAME.XXXXXX) ARCH=$(uname -m) readonly RPMBUILD_ROOT ARCH @@ -39,7 +40,7 @@ main() { sed -i "s/^Version:.*/Version: $VERSION/" "SPECS/$PKGNAME.spec" rpmbuild -bb --define "_topdir $RPMBUILD_ROOT" "SPECS/$PKGNAME.spec" - cp "$RPMBUILD_ROOT/RPMS/$ARCH/"*.rpm "$OUTPUT" + mv "$RPMBUILD_ROOT/RPMS/$ARCH/"*.rpm "$OUTPUT" rm -rf "$RPMBUILD_ROOT" ;;