| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-util/schroot/schroot-1.4.25.ebuild,v 1.1 2012/03/03 21:20:28 abcd Exp $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 6 |
|
| 7 |
inherit autotools base pam versionator
|
| 8 |
|
| 9 |
MY_P=${PN}_${PV}
|
| 10 |
|
| 11 |
DESCRIPTION="Utility to execute commands in a chroot environment"
|
| 12 |
HOMEPAGE="http://packages.debian.org/source/sid/schroot"
|
| 13 |
SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${MY_P}.orig.tar.xz"
|
| 14 |
|
| 15 |
LICENSE="GPL-3"
|
| 16 |
SLOT="0"
|
| 17 |
KEYWORDS="~amd64 ~x86"
|
| 18 |
IUSE="btrfs +dchroot debug doc lvm nls pam test"
|
| 19 |
|
| 20 |
COMMON_DEPEND="
|
| 21 |
>=dev-libs/boost-1.42.0
|
| 22 |
dev-libs/lockdev
|
| 23 |
>=sys-apps/util-linux-2.16
|
| 24 |
btrfs? ( >=sys-fs/btrfs-progs-0.19-r2 )
|
| 25 |
lvm? ( sys-fs/lvm2 )
|
| 26 |
pam? ( sys-libs/pam )
|
| 27 |
"
|
| 28 |
|
| 29 |
DEPEND="${COMMON_DEPEND}
|
| 30 |
app-arch/xz-utils
|
| 31 |
sys-apps/groff
|
| 32 |
doc? (
|
| 33 |
app-doc/doxygen
|
| 34 |
media-gfx/graphviz
|
| 35 |
)
|
| 36 |
nls? ( sys-devel/gettext )
|
| 37 |
test? ( >=dev-util/cppunit-1.10.0 )
|
| 38 |
"
|
| 39 |
RDEPEND="${COMMON_DEPEND}
|
| 40 |
sys-apps/debianutils
|
| 41 |
dchroot? ( !sys-apps/dchroot )
|
| 42 |
nls? ( virtual/libintl )
|
| 43 |
"
|
| 44 |
|
| 45 |
PATCHES=(
|
| 46 |
"${FILESDIR}/${PN}-1.4.7-tests.patch"
|
| 47 |
)
|
| 48 |
|
| 49 |
src_prepare() {
|
| 50 |
base_src_prepare
|
| 51 |
|
| 52 |
# Don't depend on cppunit unless we are testing
|
| 53 |
use test || sed -i '/AM_PATH_CPPUNIT/d' configure.ac
|
| 54 |
|
| 55 |
eautoreconf
|
| 56 |
}
|
| 57 |
|
| 58 |
src_configure() {
|
| 59 |
root_tests=no
|
| 60 |
use test && (( EUID == 0 )) && root_tests=yes
|
| 61 |
econf \
|
| 62 |
$(use_enable btrfs btrfs-snapshot) \
|
| 63 |
$(use_enable doc doxygen) \
|
| 64 |
$(use_enable dchroot) \
|
| 65 |
$(use_enable dchroot dchroot-dsa) \
|
| 66 |
$(use_enable debug) \
|
| 67 |
$(use_enable lvm lvm-snapshot) \
|
| 68 |
$(use_enable nls) \
|
| 69 |
$(use_enable pam) \
|
| 70 |
--enable-block-device \
|
| 71 |
--enable-loopback \
|
| 72 |
--enable-uuid \
|
| 73 |
--enable-root-tests=$root_tests \
|
| 74 |
--enable-shared \
|
| 75 |
--disable-static \
|
| 76 |
--localstatedir="${EPREFIX}"/var \
|
| 77 |
--with-bash-completion-dir="${EPREFIX}"/usr/share/bash-completion
|
| 78 |
}
|
| 79 |
|
| 80 |
src_compile() {
|
| 81 |
emake all $(usev doc)
|
| 82 |
}
|
| 83 |
|
| 84 |
src_test() {
|
| 85 |
if [[ $root_tests == yes && $EUID -ne 0 ]]; then
|
| 86 |
ewarn "Disabling tests because you are no longer root"
|
| 87 |
return 0
|
| 88 |
fi
|
| 89 |
default
|
| 90 |
}
|
| 91 |
|
| 92 |
src_install() {
|
| 93 |
default
|
| 94 |
|
| 95 |
insinto /usr/share/doc/${PF}/contrib/setup.d
|
| 96 |
doins contrib/setup.d/09fsck contrib/setup.d/10mount-ssh
|
| 97 |
|
| 98 |
newinitd "${FILESDIR}"/schroot.initd schroot
|
| 99 |
newconfd "${FILESDIR}"/schroot.confd schroot
|
| 100 |
|
| 101 |
if use doc; then
|
| 102 |
docinto html/sbuild
|
| 103 |
dohtml doc/sbuild/html/*
|
| 104 |
docinto html/schroot
|
| 105 |
dohtml doc/schroot/html/*
|
| 106 |
fi
|
| 107 |
|
| 108 |
if use pam; then
|
| 109 |
rm -f "${ED}"etc/pam.d/schroot
|
| 110 |
pamd_mimic_system schroot auth account session
|
| 111 |
fi
|
| 112 |
|
| 113 |
# Remove *.la files
|
| 114 |
find "${D}" -name "*.la" -exec rm {} + || die "removal of *.la files failed"
|
| 115 |
}
|
| 116 |
|
| 117 |
pkg_preinst() {
|
| 118 |
if [[ ${REPLACING_VERSIONS} == 1.2* || ${REPLACING_VERSIONS} == 1.4.0* ]]; then
|
| 119 |
einfo "Moving config files to new location..."
|
| 120 |
mkdir "${EROOT}etc/schroot/default"
|
| 121 |
mv_conffile etc/schroot/script-defaults etc/schroot/default/config
|
| 122 |
mv_conffile etc/schroot/mount-defaults etc/schroot/default/fstab
|
| 123 |
mv_conffile etc/schroot/copyfiles-defaults etc/schroot/default/copyfiles
|
| 124 |
mv_conffile etc/schroot/nssdatabases-defaults etc/schroot/default/nssdatabases
|
| 125 |
fi
|
| 126 |
}
|
| 127 |
|
| 128 |
mv_conffile() {
|
| 129 |
local OLDFILE=${EROOT}$1
|
| 130 |
local NEWFILE=${EROOT}$2
|
| 131 |
|
| 132 |
# if the old file doesn't exist, or is a symlink, stop
|
| 133 |
[[ -f ${OLDFILE} ]] || return 0
|
| 134 |
[[ -L ${OLDFILE} ]] && return 0
|
| 135 |
|
| 136 |
# if the new file already exists, then we have a problem...
|
| 137 |
if [[ -e ${NEWFILE} ]]; then
|
| 138 |
# but if they are the same, then don't worry about it
|
| 139 |
if cmp -s "${OLDFILE}" "${NEWFILE}"; then
|
| 140 |
rm -f "${OLDFILE}"
|
| 141 |
else
|
| 142 |
ewarn "${NEWFILE} already exists, not moving ${OLDFILE}"
|
| 143 |
fi
|
| 144 |
else
|
| 145 |
mv "${OLDFILE}" "${NEWFILE}"
|
| 146 |
fi
|
| 147 |
|
| 148 |
local x y
|
| 149 |
# now move all the unmerged config files as well
|
| 150 |
for x in "${OLDFILE%/*}"/._cfg????_"${OLDFILE##*/}"; do
|
| 151 |
[[ -f ${x} ]] || continue
|
| 152 |
# /etc/schroot/._cfg0000_script-defaults -> /etc/schroot/default/._cfg0000_config
|
| 153 |
y=${x##*/}
|
| 154 |
y=${NEWFILE%*/}${y%${OLDFILE##*/}}${NEWFILE##*/}
|
| 155 |
mv "${x}" "${y}"
|
| 156 |
done
|
| 157 |
}
|
| 158 |
|
| 159 |
pkg_postinst() {
|
| 160 |
local x
|
| 161 |
if [[ ${REPLACING_VERSIONS} == 1.2* || ${REPLACING_VERSIONS} == 1.4.0* ]]; then
|
| 162 |
for x in script:config mount:fstab copyfiles nssdatabases; do
|
| 163 |
if [[ ! -e ${EROOT}etc/schroot/${x%:*}-defaults && -f ${EROOT}etc/schroot/default/${x#*:} ]]; then
|
| 164 |
einfo "Creating compatibility symlink for ${x%:*}-defaults"
|
| 165 |
ln -sf "default/${x#*:}" "${ROOT}etc/schroot/${x%:*}-defaults"
|
| 166 |
fi
|
| 167 |
done
|
| 168 |
|
| 169 |
ewarn "Your config files have been moved to the new location in"
|
| 170 |
ewarn "/etc/schroot/default. Compatibility symlinks have been installed in"
|
| 171 |
ewarn "/etc/schroot, and may be removed if no running chroot refers to them."
|
| 172 |
fi
|
| 173 |
}
|