/[gentoo-x86]/eclass/fcaps.eclass
Gentoo

Diff of /eclass/fcaps.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.3 Revision 1.4
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/fcaps.eclass,v 1.3 2013/01/30 07:15:49 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/fcaps.eclass,v 1.4 2013/04/28 03:11:47 vapier Exp $
4 4
5# @ECLASS: fcaps.eclass 5# @ECLASS: fcaps.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Constanze Hausner <constanze@gentoo.org> 7# Constanze Hausner <constanze@gentoo.org>
8# base-system@gentoo.org 8# base-system@gentoo.org
123 # If everything goes well, we don't want the file to be readable 123 # If everything goes well, we don't want the file to be readable
124 # by people. 124 # by people.
125 chmod ${caps_mode} "${file}" || die 125 chmod ${caps_mode} "${file}" || die
126 126
127 if ! out=$(LC_ALL=C setcap "${caps}" "${file}" 2>&1) ; then 127 if ! out=$(LC_ALL=C setcap "${caps}" "${file}" 2>&1) ; then
128 if [[ ${out} != *"Operation not supported"* ]] ; then 128 case ${out} in
129 eerror "Setting caps '${caps}' on file '${file}' failed:" 129 *"command not found"*)
130 eerror "${out}" 130 if [[ -z ${__FCAPS_WARNED} ]] ; then
131 die "could not set caps" 131 __FCAPS_WARNED="true"
132 else 132 ewarn "Could not find cap utils. Please make sure libcap is available."
133 fi
134 ;;
135 *"Operation not supported"*)
133 local fstype=$(stat -f -c %T "${file}") 136 local fstype=$(stat -f -c %T "${file}")
134 ewarn "Could not set caps on '${file}' due to missing filesystem support." 137 ewarn "Could not set caps on '${file}' due to missing filesystem support."
135 ewarn "Make sure you enable XATTR support for '${fstype}' in your kernel." 138 ewarn "Make sure you enable XATTR support for '${fstype}' in your kernel."
136 ewarn "You might also have to enable the relevant FS_SECURITY option." 139 ewarn "You might also have to enable the relevant FS_SECURITY option."
137 fi 140 ;;
141 *)
142 eerror "Setting caps '${caps}' on file '${file}' failed:"
143 eerror "${out}"
144 die "could not set caps"
145 ;;
146 esac
138 else 147 else
139 # Sanity check that everything took. 148 # Sanity check that everything took.
140 setcap -v "${caps}" "${file}" >/dev/null \ 149 setcap -v "${caps}" "${file}" >/dev/null \
141 || die "Checking caps '${caps}' on '${file}' failed" 150 || die "Checking caps '${caps}' on '${file}' failed"
142 151

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.20