tests: small fixes on builders scripts.

This commit is contained in:
Alexandre Pujol 2024-10-16 23:58:48 +01:00
parent 4797026e28
commit d406596124
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
4 changed files with 21 additions and 19 deletions

View File

@ -12,7 +12,8 @@ readonly PREFIX="builder-"
readonly PKGNAME=apparmor.d
readonly VOLUME=/tmp/build
readonly BUILDIR=/home/build/tmp
readonly OUTPUT=".pkg"
readonly OUTDIR=".pkg"
readonly OUTPUT="$PWD/$OUTDIR"
readonly COMMAND="$1"
VERSION="0.$(git rev-list --count HEAD)"
PACKAGER="$(git config user.name) <$(git config user.email)>"
@ -63,7 +64,7 @@ build_in_docker_makepkg() {
fi
docker exec --workdir="$BUILDIR/$PKGNAME" "$img" bash dists/build.sh pkg
mv "$VOLUME/$PKGNAME"-*.pkg.* "$OUTPUT"
mv "$VOLUME/$PKGNAME/$OUTDIR/$PKGNAME"-*.pkg.* "$OUTPUT"
}
build_in_docker_dpkg() {
@ -86,7 +87,7 @@ build_in_docker_dpkg() {
fi
docker exec --workdir="$BUILDIR/$PKGNAME" "$img" bash dists/build.sh dpkg
mv "$VOLUME/$PKGNAME/${PKGNAME}_${VERSION}-1"_*.* "$OUTPUT"
mv "$VOLUME/$PKGNAME/$OUTDIR/${PKGNAME}_${VERSION}-1"_*.* "$OUTPUT"
}
build_in_docker_rpm() {
@ -105,7 +106,7 @@ build_in_docker_rpm() {
fi
docker exec --workdir="$BUILDIR/$PKGNAME" "$img" bash dists/build.sh rpm
mv "$VOLUME/$PKGNAME/$PKGNAME-$VERSION-"*.rpm "$OUTPUT"
mv "$VOLUME/$PKGNAME/$OUTDIR/$PKGNAME-$VERSION-"*.rpm "$OUTPUT"
}
main() {

View File

@ -29,18 +29,17 @@ build {
provisioner "file" {
only = ["qemu.opensuse"]
destination = "/tmp/src/"
sources = ["${path.cwd}/../apparmor.d-${var.version}-1.x86_64.rpm"]
sources = ["${path.cwd}/../.pkg/apparmor.d-${var.version}-1.x86_64.rpm"]
}
provisioner "file" {
only = ["qemu.debian", "qemu.ubuntu22", "qemu.ubuntu24"]
destination = "/tmp/src/"
sources = ["${path.cwd}/../apparmor.d_${var.version}-1_amd64.deb"]
sources = ["${path.cwd}/../.pkg/apparmor.d_${var.version}-1_amd64.deb"]
}
# Wait for cloud-init to finish
provisioner "shell" {
except = ["qemu.opensuse"]
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
inline = [
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for Cloud-Init...'; sleep 20; done",

View File

@ -15,6 +15,16 @@ readonly SRC=/tmp/src
readonly DISTRIBUTION
main() {
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/Projects/apparmor.d" "/home/$SUDO_USER/.config/"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/.bash_aliases "/home/$SUDO_USER/.bash_aliases"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/monitors.xml "/home/$SUDO_USER/.config/monitors.xml"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/htoprc "/home/$SUDO_USER/.config/htop/htoprc"
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
install -Dm0755 $SRC/aa-log-clean /usr/bin/aa-log-clean
cat $SRC/parser.conf >>/etc/apparmor/parser.conf
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
case "$DISTRIBUTION" in
arch)
pacman --noconfirm -U $SRC/*.pkg.tar.zst
@ -35,16 +45,6 @@ main() {
;;
esac
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/Projects/apparmor.d" "/home/$SUDO_USER/.config/"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/.bash_aliases "/home/$SUDO_USER/.bash_aliases"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/monitors.xml "/home/$SUDO_USER/.config/monitors.xml"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/htoprc "/home/$SUDO_USER/.config/htop/htoprc"
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
install -Dm0755 $SRC/aa-log-clean /usr/bin/aa-log-clean
cat $SRC/parser.conf >>/etc/apparmor/parser.conf
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
}
main "$@"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eu
export BUILDDIR=/tmp/build/ PKGDEST=/tmp/pkg
export BUILDDIR=/tmp/build/
# shellcheck source=/dev/null
_lsb_release() {
@ -20,6 +20,8 @@ debian | ubuntu | whonix)
make dpkg
sudo rm -rf debian/.debhelper/
;;
opensuse*) make rpm ;;
opensuse*)
make rpm
;;
*) ;;
esac