diff options
author | Chris PeBenito <pebenito@gentoo.org> | 2003-05-22 19:42:27 +0000 |
---|---|---|
committer | Chris PeBenito <pebenito@gentoo.org> | 2003-05-22 19:42:27 +0000 |
commit | 21cc3bdcc96309206f002cde9bccd7bcee980e59 (patch) | |
tree | 6327a0b80f33e9501b0dccb6809526b41bc95611 /sys-apps | |
parent | Changed ~sparc keyword to sparc. (diff) | |
download | gentoo-2-21cc3bdcc96309206f002cde9bccd7bcee980e59.tar.gz gentoo-2-21cc3bdcc96309206f002cde9bccd7bcee980e59.tar.bz2 gentoo-2-21cc3bdcc96309206f002cde9bccd7bcee980e59.zip |
adding rlpkg script which will be installed in future selinux-small's
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/selinux-small/Manifest | 5 | ||||
-rw-r--r-- | sys-apps/selinux-small/files/rlpkg | 58 |
2 files changed, 61 insertions, 2 deletions
diff --git a/sys-apps/selinux-small/Manifest b/sys-apps/selinux-small/Manifest index 9ed688eee1bc..ec443c233621 100644 --- a/sys-apps/selinux-small/Manifest +++ b/sys-apps/selinux-small/Manifest @@ -1,8 +1,9 @@ -MD5 5f53b492ab89de7607a70d08f844228e selinux-small-2003011510-r4.ebuild 4212 MD5 66f378585e11a8229bc89202d00f09fb ChangeLog 3319 +MD5 5f53b492ab89de7607a70d08f844228e selinux-small-2003011510-r4.ebuild 4212 MD5 6ed2547809a991a94a1cfd1aa19cd875 selinux-small-2003040709-r1.ebuild 4482 +MD5 4487057dc383a5e8f1b0424242308452 files/rlpkg 1788 MD5 e5ffaa323b22754b51eaa94f04bcf5dd files/digest-selinux-small-2003011510-r4 151 +MD5 0986e11cde481cc9d4f8061654dedead files/digest-selinux-small-2003040709-r1 151 MD5 5b8ae6c77d50a559c31fb144faf6843e files/selinux-small-2003011510-bison.diff 553 MD5 5b8ae6c77d50a559c31fb144faf6843e files/selinux-small-2003040709-bison.diff 553 -MD5 0986e11cde481cc9d4f8061654dedead files/digest-selinux-small-2003040709-r1 151 MD5 3809db44913b783d2b8bb31c8361aa92 files/selinux-small-2003040709-setfiles.diff 2623 diff --git a/sys-apps/selinux-small/files/rlpkg b/sys-apps/selinux-small/files/rlpkg new file mode 100644 index 000000000000..1e775b837cff --- /dev/null +++ b/sys-apps/selinux-small/files/rlpkg @@ -0,0 +1,58 @@ +#!/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.1 2003/05/22 19:42:23 pebenito Exp $ + +# Author: Chris PeBenito <pebenito@gentoo.org> +# this probably isnt the cleanest script, but it works. +# +# TODO: +# -make it accept more than 1 pkg on the cmd line +# -maybe add a -l function to list the package's files + contexts +# -more informative messages, -h for help + +. /sbin/functions.sh +PROG=`basename ${0}` + +if [ -z ${1} ]; then + echo "The Gentoo Linux package relabeler" + echo + eerror "Usage: ${PROG} <pkg>" + echo + echo "${PROG} relabels gentoo packages based on their CONTENTS file." + echo "Any files associated with a package, but not in the contents" + echo "will not be relabeled, so be careful! When in doubt, a full" + echo "relabel should be done." + exit 1; +fi + +[ -z ${POLICYDIR} ] && POLICYDIR="/etc/security/selinux/src/policy" + +# make sure the policydir exists +if [ ! -d ${POLICYDIR} ]; then + eerror "The policy directory doesnt exist!" + echo + ewarn "Set the policy dir: export POLICYDIR=\"/etc/security/selinux/src/mypolicy\"" + ewarn "or set it by using an env variable." + exit 1 +fi + +cd ${POLICYDIR} +ewarn "Using file contexts from the policy in ${POLICYDIR}" + +# generate file_contexts as needed +if [ ! -f ./file_contexts/file_contexts ]; then + ebegin "Generating file contexts" + make file_contexts/file_contexts &> /dev/null + eend $? +fi + +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 file_contexts/file_contexts -sq &> /dev/null + eend $? +done |