summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris PeBenito <pebenito@gentoo.org>2003-07-04 01:41:09 +0000
committerChris PeBenito <pebenito@gentoo.org>2003-07-04 01:41:09 +0000
commitfa3d56f1db93efcade552d16af8e6d7957ba8f78 (patch)
tree16e445301ce3efedc86259c04dcf903bb03db177 /sys-apps
parentinitial commit (diff)
downloadhistorical-fa3d56f1db93efcade552d16af8e6d7957ba8f78.tar.gz
historical-fa3d56f1db93efcade552d16af8e6d7957ba8f78.tar.bz2
historical-fa3d56f1db93efcade552d16af8e6d7957ba8f78.zip
improve rlpkg package matching
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/selinux-small/ChangeLog5
-rw-r--r--sys-apps/selinux-small/Manifest4
-rw-r--r--sys-apps/selinux-small/files/rlpkg39
3 files changed, 30 insertions, 18 deletions
diff --git a/sys-apps/selinux-small/ChangeLog b/sys-apps/selinux-small/ChangeLog
index ea06ef0093b2..c41f2431ef4c 100644
--- a/sys-apps/selinux-small/ChangeLog
+++ b/sys-apps/selinux-small/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for sys-apps/selinux-small
# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/selinux-small/ChangeLog,v 1.23 2003/06/29 04:17:45 pebenito Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/selinux-small/ChangeLog,v 1.24 2003/07/04 01:41:04 pebenito Exp $
+
+ 03 Jul 2003; Chris PeBenito <pebenito@gentoo.org> files/rlpkg:
+ Improve rlpkg package matching
28 Jun 2003; Chris PeBenito <pebenito@gentoo.org>
selinux-small-2003040709-r4.ebuild:
diff --git a/sys-apps/selinux-small/Manifest b/sys-apps/selinux-small/Manifest
index 149109d335e0..e7272af381f1 100644
--- a/sys-apps/selinux-small/Manifest
+++ b/sys-apps/selinux-small/Manifest
@@ -1,4 +1,4 @@
-MD5 f88c131ca9d285be1ba7ad2d0126331a ChangeLog 5505
+MD5 c3339664f38fee9d30739fde0179e80d ChangeLog 5604
MD5 effd006ee5a76d62ceeef715b5dbf00b selinux-small-2003040709-r3.ebuild 4399
MD5 8098f68887ec205cb21d4e5a7355d764 selinux-small-2003040709-r4.ebuild 5447
MD5 74ed0ebe40bb920f2c477898e6e9abc0 metadata.xml 457
@@ -6,7 +6,7 @@ MD5 0986e11cde481cc9d4f8061654dedead files/digest-selinux-small-2003040709-r3 15
MD5 14ef7a8e2104665076099d6fe3f0f664 files/digest-selinux-small-2003040709-r4 73
MD5 8daee4f4fd3e4a74c4d5f2ddb6b086a5 files/newrole 1197
MD5 89d2840cccbc46b3261d7abc79b757fd files/open_init_pty 441
-MD5 95245c95e7a1c329656d222c55fb769d files/rlpkg 1856
+MD5 40942493cfa58c7011ae2bf7d7db6194 files/rlpkg 2087
MD5 8daee4f4fd3e4a74c4d5f2ddb6b086a5 files/run_init 1197
MD5 09147c78732ba1ffb7fd0ee3c79573c6 files/scmpd 527
MD5 5b8ae6c77d50a559c31fb144faf6843e files/selinux-small-2003040709-bison.diff 553
diff --git a/sys-apps/selinux-small/files/rlpkg b/sys-apps/selinux-small/files/rlpkg
index a55cbb0a2a08..86ed3ce0965a 100644
--- a/sys-apps/selinux-small/files/rlpkg
+++ b/sys-apps/selinux-small/files/rlpkg
@@ -1,7 +1,7 @@
#!/bin/bash
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/selinux-small/files/rlpkg,v 1.2 2003/05/27 00:57:59 pebenito Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/selinux-small/files/rlpkg,v 1.3 2003/07/04 01:41:04 pebenito Exp $
# Author: Chris PeBenito <pebenito@gentoo.org>
# this probably isnt the cleanest script, but it works.
@@ -16,7 +16,7 @@ PROG=`basename ${0}`
if [ -z ${1} ]; then
echo "The Gentoo Linux package relabeler"
echo
- eerror "Usage: ${PROG} <pkg1> [<pkg2> ...]"
+ echo "Usage: ${PROG} <pkg1> [<pkg2> ...]"
echo
echo "${PROG} relabels gentoo packages based on their CONTENTS file."
echo "Any files associated with a package, but not in the contents"
@@ -25,6 +25,16 @@ if [ -z ${1} ]; then
exit 1;
fi
+while [ ${#} -gt 0 ]; do
+ build="${build} `find /var/db/pkg -iname CONTENTS | cut -d/ -f5,6 | grep ${1} | sort`"
+ shift
+done
+
+if [ "${build}" == " " ]; then
+ echo "No matching packages found."
+ exit 1
+fi
+
[ -z ${POLICYDIR} ] && POLICYDIR="/etc/security/selinux/src/policy"
# make sure the policydir exists
@@ -36,23 +46,22 @@ if [ ! -d ${POLICYDIR} ]; then
exit 1
fi
-ewarn "Using file contexts from the policy in ${POLICYDIR}"
+einfo "Using file contexts from the policy in ${POLICYDIR}."
# generate file_contexts as needed
ebegin "Regenerating file contexts"
[ -f ${POLICYDIR}/file_contexts/file_contexts ] && rm -f ${POLICYDIR}/file_contexts/file_contexts
make -C ${POLICYDIR} file_contexts/file_contexts &> /dev/null
-eend $?
-while [ ${#} -gt 0 ]; do
- build=`find /var/db/pkg -iname CONTENTS | grep ${1} | sort`
-
- for i in ${build}; do
- pkgcat=`echo ${i} | cut -d/ -f5`
- pkgnam=`echo ${i} | cut -d/ -f6`
- ebegin "Relabeling: ${pkgcat}/${pkgnam}"
- awk '{ print $2 }' < ${i} | setfiles ${POLICYDIR}/file_contexts/file_contexts -sq &> /dev/null
- eend $?
- done
- shift
+# do a test relabel to make sure file contexts work (doesnt change any labels)
+echo "/etc/passwd" | setfiles ${POLICYDIR}/file_contexts/file_contexts -sqn
+ret=$?
+eend $ret
+
+[ $ret == "0" ] || exit $ret
+
+for i in ${build}; do
+ ebegin "Relabeling: ${i}"
+ awk '{ print $2 }' < /var/db/pkg/${i}/CONTENTS | setfiles ${POLICYDIR}/file_contexts/file_contexts -sq &> /dev/null
+ eend $?
done