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