Fix apparmor_parser not found error in desktop postinst script (#9728)

Add a runtime guard in the postinst so apparmor_parser is only called
  when available. Previously, packages built on Ubuntu 24+ would fail to
  install on headless servers or systems without AppArmor tools. A warning
  is printed when the profile load is skipped to aid debugging.
pull/9743/head
Muhammad Aqeel 2026-03-10 20:29:40 +05:00 committed by GitHub
parent a0e6da0772
commit c8bd75c9a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -86,7 +86,11 @@ EOF
#!/bin/sh
echo "Load apparmor pgAdmin profile..."
apparmor_parser -r /etc/apparmor.d/pgadmin4
if command -v apparmor_parser >/dev/null 2>&1; then
apparmor_parser -r /etc/apparmor.d/pgadmin4
else
echo "Warning: apparmor_parser not found, skipping profile load. pgAdmin desktop may not work on Ubuntu 24+ with userns restrictions."
fi
EOF
chmod 755 "${DESKTOPROOT}/DEBIAN/postinst"
fi