| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/systemd/systemd-188-r1.ebuild,v 1.2 2012/08/28 16:53:42 zmedico Exp $ |
| 4 |
|
| 5 |
EAPI=4 |
| 6 |
|
| 7 |
inherit autotools-utils bash-completion-r1 linux-info pam systemd user |
| 8 |
|
| 9 |
DESCRIPTION="System and service manager for Linux" |
| 10 |
HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd" |
| 11 |
SRC_URI="http://www.freedesktop.org/software/systemd/${P}.tar.xz" |
| 12 |
|
| 13 |
LICENSE="GPL-2 LGPL-2.1 MIT" |
| 14 |
SLOT="0" |
| 15 |
KEYWORDS="~amd64 ~arm ~x86" |
| 16 |
IUSE="acl audit cryptsetup lzma pam selinux tcpd" |
| 17 |
|
| 18 |
# We need to depend on sysvinit for sulogin which is used in the rescue |
| 19 |
# mode. Bug #399615. |
| 20 |
|
| 21 |
MINKV="2.6.39" |
| 22 |
|
| 23 |
COMMON_DEPEND=">=sys-apps/dbus-1.4.10 |
| 24 |
>=sys-apps/kmod-5 |
| 25 |
>=sys-apps/util-linux-2.20 |
| 26 |
~sys-fs/udev-188 |
| 27 |
sys-libs/libcap |
| 28 |
acl? ( sys-apps/acl ) |
| 29 |
audit? ( >=sys-process/audit-2 ) |
| 30 |
cryptsetup? ( >=sys-fs/cryptsetup-1.4.2 ) |
| 31 |
lzma? ( app-arch/xz-utils ) |
| 32 |
pam? ( virtual/pam ) |
| 33 |
selinux? ( sys-libs/libselinux ) |
| 34 |
tcpd? ( sys-apps/tcp-wrappers )" |
| 35 |
|
| 36 |
# sysvinit for sulogin |
| 37 |
RDEPEND="${COMMON_DEPEND} |
| 38 |
sys-apps/hwids |
| 39 |
sys-apps/sysvinit |
| 40 |
!<sys-libs/glibc-2.10 |
| 41 |
!~sys-fs/udev-187" |
| 42 |
DEPEND="${COMMON_DEPEND} |
| 43 |
app-arch/xz-utils |
| 44 |
app-text/docbook-xsl-stylesheets |
| 45 |
dev-libs/libxslt |
| 46 |
dev-util/gperf |
| 47 |
dev-util/intltool |
| 48 |
>=sys-kernel/linux-headers-${MINKV}" |
| 49 |
|
| 50 |
AUTOTOOLS_IN_SOURCE_BUILD=1 |
| 51 |
|
| 52 |
pkg_setup() { |
| 53 |
enewgroup lock # used by var-lock.mount |
| 54 |
enewgroup tty 5 # used by mount-setup for /dev/pts |
| 55 |
} |
| 56 |
|
| 57 |
src_prepare() { |
| 58 |
# systemd-analyze is for python2.7 only nowadays. |
| 59 |
sed -i -e '1s/python/&2.7/' src/analyze/systemd-analyze |
| 60 |
|
| 61 |
# link against external udev. |
| 62 |
sed -i -e 's:libudev\.la:-ludev:' Makefile.am |
| 63 |
|
| 64 |
local PATCHES=( |
| 65 |
"${FILESDIR}"/0001-Disable-udev-targets-for-udev-188.patch |
| 66 |
) |
| 67 |
|
| 68 |
autotools-utils_src_prepare |
| 69 |
|
| 70 |
# XXX: support it within eclass |
| 71 |
eautomake |
| 72 |
} |
| 73 |
|
| 74 |
src_configure() { |
| 75 |
local myeconfargs=( |
| 76 |
--localstatedir=/var |
| 77 |
--with-distro=gentoo |
| 78 |
# install everything to /usr |
| 79 |
--with-rootprefix=/usr |
| 80 |
--with-rootlibdir=/usr/$(get_libdir) |
| 81 |
# but pam modules have to lie in /lib* |
| 82 |
--with-pamlibdir=/$(get_libdir)/security |
| 83 |
# this avoids dep on pciutils & usbutils |
| 84 |
--with-pci-ids-path=/usr/share/misc/pci.ids |
| 85 |
--with-usb-ids-path=/usr/share/misc/usb.ids |
| 86 |
# make sure we get /bin:/sbin in $PATH |
| 87 |
--enable-split-usr |
| 88 |
# udev parts |
| 89 |
--disable-introspection |
| 90 |
--disable-gtk-doc |
| 91 |
--disable-gudev |
| 92 |
$(use_enable acl) |
| 93 |
$(use_enable audit) |
| 94 |
$(use_enable cryptsetup libcryptsetup) |
| 95 |
$(use_enable lzma xz) |
| 96 |
$(use_enable pam) |
| 97 |
$(use_enable selinux) |
| 98 |
$(use_enable tcpd tcpwrap) |
| 99 |
) |
| 100 |
|
| 101 |
autotools-utils_src_configure |
| 102 |
} |
| 103 |
|
| 104 |
src_install() { |
| 105 |
autotools-utils_src_install \ |
| 106 |
bashcompletiondir=/tmp |
| 107 |
|
| 108 |
# compat for init= use |
| 109 |
dosym ../usr/lib/systemd/systemd /bin/systemd |
| 110 |
dosym ../lib/systemd/systemd /usr/bin/systemd |
| 111 |
# rsyslog.service depends on it... |
| 112 |
dosym ../usr/bin/systemctl /bin/systemctl |
| 113 |
|
| 114 |
# move files as necessary |
| 115 |
newbashcomp "${D}"/tmp/systemd-bash-completion.sh ${PN} |
| 116 |
rm -r "${D}"/tmp || die |
| 117 |
|
| 118 |
# we just keep sysvinit tools, so no need for the mans |
| 119 |
rm "${D}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 \ |
| 120 |
|| die |
| 121 |
rm "${D}"/usr/share/man/man1/init.1 || die |
| 122 |
|
| 123 |
# Create /run/lock as required by new baselay/OpenRC compat. |
| 124 |
insinto /usr/lib/tmpfiles.d |
| 125 |
doins "${FILESDIR}"/gentoo-run.conf |
| 126 |
|
| 127 |
# Check whether we won't break user's system. |
| 128 |
[[ -x "${D}"/bin/systemd ]] || die '/bin/systemd symlink broken, aborting.' |
| 129 |
[[ -x "${D}"/usr/bin/systemd ]] || die '/usr/bin/systemd symlink broken, aborting.' |
| 130 |
} |
| 131 |
|
| 132 |
pkg_preinst() { |
| 133 |
local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS ~DEVTMPFS |
| 134 |
~FANOTIFY ~HOTPLUG ~INOTIFY_USER ~IPV6 ~NET ~PROC_FS ~SIGNALFD |
| 135 |
~SYSFS ~!IDE ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2" |
| 136 |
kernel_is -ge ${MINKV//./ } || ewarn "Kernel version at least ${MINKV} required" |
| 137 |
check_extra_config |
| 138 |
} |
| 139 |
|
| 140 |
optfeature() { |
| 141 |
local i desc=${1} text |
| 142 |
shift |
| 143 |
|
| 144 |
text=" [\e[1m$(has_version ${1} && echo I || echo ' ')\e[0m] ${1}" |
| 145 |
shift |
| 146 |
|
| 147 |
for i; do |
| 148 |
elog "${text}" |
| 149 |
text="& [\e[1m$(has_version ${1} && echo I || echo ' ')\e[0m] ${1}" |
| 150 |
done |
| 151 |
elog "${text} (${desc})" |
| 152 |
} |
| 153 |
|
| 154 |
pkg_postinst() { |
| 155 |
mkdir -p "${ROOT}"/run || ewarn "Unable to mkdir /run, this could mean trouble." |
| 156 |
if [[ ! -L "${ROOT}"/etc/mtab ]]; then |
| 157 |
ewarn "Upstream suggests that the /etc/mtab file should be a symlink to /proc/mounts." |
| 158 |
ewarn "It is known to cause users being unable to unmount user mounts. If you don't" |
| 159 |
ewarn "require that specific feature, please call:" |
| 160 |
ewarn " $ ln -sf '${ROOT}proc/self/mounts' '${ROOT}etc/mtab'" |
| 161 |
ewarn |
| 162 |
fi |
| 163 |
|
| 164 |
elog "To get additional features, a number of optional runtime dependencies may" |
| 165 |
elog "be installed:" |
| 166 |
optfeature 'for systemd-analyze' \ |
| 167 |
'dev-lang/python:2.7' 'dev-python/dbus-python' |
| 168 |
optfeature 'for systemd-analyze plotting ability' \ |
| 169 |
'dev-python/pycairo[svg]' |
| 170 |
optfeature 'for GTK+ systemadm UI and gnome-ask-password-agent' \ |
| 171 |
'sys-apps/systemd-ui' |
| 172 |
elog |
| 173 |
|
| 174 |
ewarn "Please note this is a work-in-progress and many packages in Gentoo" |
| 175 |
ewarn "do not supply systemd unit files yet. You are testing it on your own" |
| 176 |
ewarn "responsibility. Please remember than you can pass:" |
| 177 |
ewarn " init=/sbin/init" |
| 178 |
ewarn "to your kernel to boot using sysvinit / OpenRC." |
| 179 |
} |