build: improve just install

This commit is contained in:
Alexandre Pujol 2025-05-18 19:33:58 +02:00
parent 10ef829d31
commit 86afef4920
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 10 additions and 6 deletions

View file

@ -18,7 +18,7 @@
# Build setings # Build setings
destdir := "/" destdir := "/"
build := ".build" build := ".build"
pkgdest := `pwd` / ".pkg/dist" pkgdest := `pwd` / ".pkg"
pkgname := "apparmor.d" pkgname := "apparmor.d"
# Admin username # Admin username
@ -86,13 +86,16 @@ install:
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu -o pipefail set -eu -o pipefail
install -Dm0755 {{build}}/aa-log {{destdir}}/usr/bin/aa-log install -Dm0755 {{build}}/aa-log {{destdir}}/usr/bin/aa-log
for file in $(find "{{build}}/share" -type f -not -name "*.md" -printf "%P\n"); do mapfile -t share < <(find "{{build}}/share" -type f -not -name "*.md" -printf "%P\n")
for file in "${share[@]}"; do
install -Dm0644 "{{build}}/share/$file" "{{destdir}}/usr/share/$file" install -Dm0644 "{{build}}/share/$file" "{{destdir}}/usr/share/$file"
done done
for file in $(find "{{build}}/apparmor.d" -type f -printf "%P\n"); do mapfile -t aa < <(find "{{build}}/apparmor.d" -type f -printf "%P\n")
for file in "${aa[@]}"; do
install -Dm0644 "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file" install -Dm0644 "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file"
done done
for file in $(find "{{build}}/apparmor.d" -type l -printf "%P\n"); do mapfile -t links < <(find "{{build}}/apparmor.d" -type l -printf "%P\n")
for file in "${links[@]}"; do
mkdir -p "{{destdir}}/etc/apparmor.d/disable" mkdir -p "{{destdir}}/etc/apparmor.d/disable"
cp -d "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file" cp -d "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file"
done done
@ -155,7 +158,7 @@ serve:
clean: clean:
@rm -rf \ @rm -rf \
debian/.debhelper debian/debhelper* debian/*.debhelper debian/{{pkgname}} \ debian/.debhelper debian/debhelper* debian/*.debhelper debian/{{pkgname}} \
.pkg/{{pkgname}}* {{build}} coverage.out {{pkgdest}}/{{pkgname}}* {{build}} coverage.out
[doc('Build the package in a clean OCI container')] [doc('Build the package in a clean OCI container')]
package dist: package dist:

View file

@ -30,7 +30,8 @@ build() {
export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}" export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
DISTRIBUTION=arch just complain export DISTRIBUTION=arch
just complain
} }
package() { package() {