tests(packer): simplify pkg install script.

This commit is contained in:
Alexandre Pujol 2025-08-31 13:29:11 +02:00
parent a3426fef8c
commit 9ee2605026
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC

View file

@ -3,16 +3,11 @@
# Copyright (C) 2023-2024 Alexandre Pujol <alexandre@pujol.io> # Copyright (C) 2023-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
set -eux set -eux -o pipefail
_lsb_release() { # shellcheck source=/dev/null
# shellcheck source=/dev/null source /etc/os-release || exit 1
. /etc/os-release
echo "$ID"
}
DISTRIBUTION="$(_lsb_release)"
readonly SRC=/tmp/ readonly SRC=/tmp/
readonly DISTRIBUTION
main() { main() {
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/Projects/apparmor.d" "/home/$SUDO_USER/.config/" install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/Projects/apparmor.d" "/home/$SUDO_USER/.config/"
@ -24,7 +19,7 @@ main() {
install -Dm0755 $SRC/aa-clean /usr/bin/aa-clean install -Dm0755 $SRC/aa-clean /usr/bin/aa-clean
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/" chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
case "$DISTRIBUTION" in case "$ID" in
arch) arch)
rm -f $SRC/*.sig # Ignore signature files rm -f $SRC/*.sig # Ignore signature files
rm -f $SRC/*enforced* # Ignore enforced package rm -f $SRC/*enforced* # Ignore enforced package
@ -32,8 +27,10 @@ main() {
;; ;;
debian | ubuntu) debian | ubuntu)
apt-get install -y apparmor-profiles # Do not install apparmor.d on the current development version
dpkg -i $SRC/*.deb || true if [[ $VERSION_ID != "25.10" ]]; then
dpkg -i $SRC/*.deb || true
fi
;; ;;
opensuse*) opensuse*)