Commit
Author: Kevin Schoon [kevinschoon@gmail.com]
Hash: 04699f811170523f0674c6fb2d0b17f25664bc06
Timestamp: Sun, 13 Sep 2020 20:32:04 +0000 (4 years ago)

+14 -9 +/-2 browse
fix build permissions
1diff --git a/scripts/generate_build_artifact.sh b/scripts/generate_build_artifact.sh
2index 3a553bc..e3c291c 100755
3--- a/scripts/generate_build_artifact.sh
4+++ b/scripts/generate_build_artifact.sh
5 @@ -1,7 +1,7 @@
6 #!/bin/bash
7 # Generate a compiled build artifact. This is a hack because
8 # to the best of my knowledge the distribution story for OCaml
9- # binaries is terrible AFAICT. Dynamic linking means we need to
10+ # binaries is terrible. Dynamic linking means we need to
11 # compile against the oldest version of GLIBC we wish to support.
12 # We also link against Alpine muslc for convenience. It is not
13 # possible to compile Mach-O Darwin executables from Linux, again,
14 @@ -31,14 +31,21 @@ dune build
15 PKG="note-$PREFIX-$VERSION"
16 PKG_PATH="pkg/$PKG"
17 PKG_TARGET="pkg/$PKG.tar.gz"
18+ SOURCE="$(realpath "_build/install/default")"
19
20 mkdir -p "$PKG_PATH"
21- cp -rLv _build/install/default/* "$PKG_PATH"
22- rm -vf "$PKG_PATH/bin/note"
23+ pushd "$PKG_PATH"
24+ mkdir -p usr/bin
25+ mkdir -p usr/share/man/man1
26+ cp "$SOURCE/man/man1/note.1" usr/share/man/man1/
27+ mkdir -p usr/share/bash-completion/completion
28+ cp "$SOURCE/share/note/note.bash" usr/share/bash-completion/completion/
29+ gzip usr/share/man/man1/note.1
30+ popd
31+
32 docker build -t "$PKG" -f "$DOCKER_FILE" .
33 container_id="$(docker create $PKG)"
34- docker cp "$container_id:/usr/bin/note" "$PKG_PATH/bin/note"
35+ docker cp "$container_id:/usr/bin/note" "$PKG_PATH/usr/bin/note"
36 docker rm "$container_id" 1>/dev/null
37-
38- tar -C "$PKG_PATH" -czvf "$PKG_TARGET" .
39+ tar --owner root --group root -C "$PKG_PATH" -czvf "$PKG_TARGET" .
40 md5sum "$PKG_TARGET" > "$PKG_TARGET.md5"
41 diff --git a/scripts/generate_deb_artifact.sh b/scripts/generate_deb_artifact.sh
42index 9b42848..f602af9 100755
43--- a/scripts/generate_deb_artifact.sh
44+++ b/scripts/generate_deb_artifact.sh
45 @@ -32,7 +32,5 @@ EOF
46 cp -r "$BUILD_ARTIFACT"/* "$PKG_PATH/"
47
48 # TODO: dune doesn't allow this path somehow
49- mkdir -p "$PKG_PATH/usr/share/bash-completion/completions"
50- mv "$PKG_PATH/share/note/note.bash" "$PKG_PATH/usr/share/bash-completion/completions/"
51- dpkg-deb -b "$PKG_PATH"
52+ dpkg-deb --root-owner-group -b "$PKG_PATH"
53 md5sum "$PKG_TARGET" > "$PKG_TARGET.md5"