[Apparmor-dev] [RFC 1/5] initscript: ignore more dpkg
Steve Beattie
sbeattie at suse.de
Wed Apr 4 12:31:44 MDT 2007
In the recent fixups for Ubuntu/Debian, .dpkg-new files got added to the
set of profile names that get ignored. Alas, that only got added in one
of two locations in the initscript; this patch fixes that by making a
common test function that both locations use.
---
parser/rc.apparmor.functions | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
Index: b/parser/rc.apparmor.functions
===================================================================
--- a/parser/rc.apparmor.functions
+++ b/parser/rc.apparmor.functions
@@ -102,6 +102,18 @@ fi
# keep exit status from parser during profile load. 0 is good, 1 is bad
STATUS=0
+skip_profile() {
+ local profile=$1
+ if [ "${profile%.rpmnew}" != "${profile}" -o \
+ "${profile%.rpmsave}" != "${profile}" -o \
+ "${profile%.dpkg-new}" != "${profile}" -o \
+ "${profile%\~}" != "${profile}" ] ; then
+ return 0
+ fi
+
+ return 1
+}
+
parse_profiles() {
# get parser arg
case "$1" in
@@ -135,11 +147,7 @@ parse_profiles() {
fi
for profile in $PROFILE_DIR/*; do
- if [ "${profile%.rpmnew}" != "${profile}" -o \
- "${profile%.rpmsave}" != "${profile}" -o \
- "${profile%.dpkg-new}" != "${profile}" -o \
- "${profile%\~}" != "${profile}" ]
- then
+ if skip_profile "${profile}" ; then
echo " Skipping profile $profile"
logger -t "AppArmor(init)" -p daemon.warn "Skipping profile $profile"
STATUS=2
@@ -175,12 +183,7 @@ profiles_names_list() {
fi
for profile in $PROFILE_DIR/*; do
- if [ "${profile%.rpmnew}" != "${profile}" -o \
- "${profile%.rpmsave}" != "${profile}" -o \
- "${profile%\~}" != "${profile}" ]
- then
- echo "nop" >/dev/null
- elif [ -f "${profile}" ] ; then
+ if ! skip_profile "${profile}" && [ -f "${profile}" ] ; then
LIST_ADD=$($PARSER $ABSTRACTIONS -N "$profile" | grep -v '\^')
if [ $? -eq 0 ]; then
echo "$LIST_ADD" >>$TMPFILE
--
Steve Beattie
SUSE Labs, Novell Inc.
<sbeattie at suse.de>
http://NxNW.org/~steve/
More information about the Apparmor-dev
mailing list