# $Id$ PNAME="systemd" PVER="37" PBUILD="r3" SPLIT_PACKAGES="systemd systemd-tools" PCATEGORIE="sys-apps" HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd" # enable sysvinit support atm for compatibility reasons # y=yes, n=no SYSVINIT_SUPPORT="n" SPECIAL_VARS="SYSVINIT_SUPPORT" COMMON_DEPEND=">= sys-apps/dbus-1.5 >= sys-fs/udev-172 >= dev-libs/dbus-glib-0.98 >= sys-apps/tcp-wrappers-7.6 >= sys-libs/pam-1.1 >= sys-libs/libcap-2.20 >= sys-apps/util-linux-2.20 >= sys-apps/shadow-4.1 >= sys-apps/sysvinit-tools-2.88" TOOLS_DEPEND=">= x11-libs/gtk2+-2.24 >= dev-python/dbus-python-0.84 >= sys-apps/polkit-0.102" if [[ ${SYSVINIT_SUPPORT} = y ]] then DEPEND="${DEPEND} >= sys-apps/sysvinit-2.88" fi SDEPEND=">= app-text/docbook-xsl-stylesheets-1.76 >= dev-libs/libcgroup-0.37 >= dev-libs/libxslt-1.1.26 >= dev-lang/vala-0.12 >= dev-util/intltool-0.41 >= dev-util/gperf-3 >= virtual/kernel-headers >= x11-libs/libnotify-0.7.3" SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" sminclude mtools SRC_URI=( http://www.freedesktop.org/software/${PNAME}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-37-magellan.patch mirror://${PNAME}/${PNAME}-33-magellan-configurable-getty-5.patch mirror://${PNAME}/login-manager.pamd mirror://${PNAME}/${PNAME}-${PVER}-unit-fix-complementing-of-requirement-deps-with-after.patch mirror://${PNAME}/${PNAME}-${PVER}-manager-fix-a-crash-in-isolating.patch mirror://${PNAME}/${PNAME}-${PVER}-systemctl-completion-always-invoke-with-no-legend.patch mirror://${PNAME}/${PNAME}-${PVER}-mount-order-remote-mounts-after-both-network.target-and-remote-fs-pre.target.patch mirror://${PNAME}/${PNAME}-${PVER}-units-drop-install-section-from-remote-fs-pre.target.patch ) UP2DATE="updatecmd http://www.freedesktop.org/software/systemd/ | lasttarball" split_info_systemd() { DESCRIPTION="System and Session Manager." DEPEND="${COMMON_DEPEND}" } split_info_systemd-tools() { DESCRIPTION="Systemd utilites for gtk2/gnome and for analysing the boot process." DEPEND="== sys-apps/systemd-${PVER} ${TOOLS_DEPEND}" } src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # apply our magellan patch mpatch ${PNAME}-37-magellan.patch || die # magellan-only: use a configurable getty mpatch ${PNAME}-33-magellan-configurable-getty-5.patch || die # upstream and fedore patches # from fedora: # revert this one for https://bugzilla.redhat.com/show_bug.cgi?id=741078 # must keep until https://bugzilla.redhat.com/show_bug.cgi?id=741115 is fixed. patch -Np1 -R -i ${SOURCEDIR}/${PNAME}/${PNAME}-${PVER}-unit-fix-complementing-of-requirement-deps-with-after.patch || die # # some post-v37 patches from upstream: mpatch ${PNAME}-${PVER}-manager-fix-a-crash-in-isolating.patch || die mpatch ${PNAME}-${PVER}-systemctl-completion-always-invoke-with-no-legend.patch || die mpatch ${PNAME}-${PVER}-mount-order-remote-mounts-after-both-network.target-and-remote-fs-pre.target.patch || die mpatch ${PNAME}-${PVER}-units-drop-install-section-from-remote-fs-pre.target.patch || die # regen configure mautoreconf || die } src_compile() { cd ${SRCDIR} mconfigure \ --with-distro=magellan \ --libexecdir=/usr/$(mlibdir)/${PNAME} \ --with-pamlibdir=/$(mlibdir)/security \ --with-rootdir=/ \ --enable-gtk \ --enable-pam \ --enable-tcpwrap \ --disable-audit \ --disable-selinux \ || die mmake || die } src_install_systemd() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} install || die # omit for now as pretty_print works # # install os-release file # cat > ${BINDIR}/etc/os-release << EOF # NAME="Magellan Linux" # ID=magellan # PRETTY_NAME="Magellan Linux" # ANSI_COLOR="1;34" # EOF # keep some directories mkeepdir /run || die mkeepdir /etc/modules-load.d || die if [[ ${SYSVINIT_SUPPORT} != y ]] then echo "Include SysV init Compat symlinks" # create SysV compatibility symlinks. systemctl/systemd are smart # enough to detect in which way they are called. minstalldir /sbin || die mlink ../bin/systemd /sbin/init || die local i for i in reboot halt poweroff shutdown telinit runlevel do mlink ../bin/systemctl /sbin/${i} || die done else echo "Using sysvinit package for SysV compat" fi # we create all wants links manually at installation time to make sure # they are not owned and hence overriden by mage after the user deleted # them. rm -r ${BINDIR}/etc/systemd/system/*.target.wants || die # but make sure these directories are properly owned mkeepdir /lib/systemd/system/basic.target.wants || die mkeepdir /lib/systemd/system/default.target.wants || die mkeepdir /lib/systemd/system/dbus.target.wants || die mkeepdir /lib/systemd/system/syslog.target.wants || die # login-manager pam policy - force register kdm, gdm etc with pam_systemd minstallpam login-manager.pamd login-manager || die minstalldocs DISTRO_PORTING LICENSE README TODO || die # remove files which are owned by other packages rm ${BINDIR}/usr/bin/systemadm || die rm ${BINDIR}/usr/bin/systemd-analyze || die rm ${BINDIR}/usr/bin/systemd-gnome-ask-password-agent || die rm ${BINDIR}/usr/share/man/man1/systemadm.* || die } src_install_systemd-tools() { cd ${SRCDIR} minstallexec systemadm || die minstallexec systemd-analyze || die minstallexec systemd-gnome-ask-password-agent || die minstallman man/systemadm.1 || die } preinstall_systemd() { if [[ ${SYSVINIT_SUPPORT} = n ]] then if [[ ! -z $(magequery -n sysvinit) ]] then echo -e ${COLRED} echo -e "Error: sys-apps/sysvinit is installed!!" echo -e "sysvinit is now replaced by systemd which is the new default init system." echo -e "Please uninstall sys-apps/sysvinit first!" echo -e ${COLDEFAULT} die "sys-apps/sysvinit found!" fi fi # adding lock group ${MLIBDIR}/mgroupadd -o "-g 54" lock } postinstall_systemd() { # try to read default runlevel from the old inittab if it exists local runlevel runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null) local target if [[ -z ${runlevel} ]] then target="/lib/systemd/system/graphical.target" else target="/lib/systemd/system/runlevel${runlevel}.target" fi # and symlink what we found to the new-style default.target ln -snf ${target} ${MROOT}/etc/systemd/system/default.target # convert modules.autoload if [ -f ${MROOT}/etc/modules.autoload ] then local modules # get only lines which are not commented or empty; # if we get any items than the modules.autoload is in use modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload) if [[ ! -z ${modules} ]] then [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \ > ${MROOT}/etc/modules-load.d/modules.autoload.conf cat ${MROOT}/etc/modules.autoload \ >> ${MROOT}/etc/modules-load.d/modules.autoload.conf fi fi # check mtab, and replace with a symlink if required if [[ ! -L ${MROOT}/etc/mtab ]] || \ [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]] then ln -snf /proc/self/mounts ${MROOT}/etc/mtab fi if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] then # create machine-id if [ ! -f /etc/machine-id ] then systemd-machine-id-setup fi # restart systemd daemon systemctl daemon-reexec # restart systemd-logind daemon systemctl try-restart systemd-logind.service # enable the services we install by default. systemctl enable \ getty@.service \ remote-fs.target \ systemd-readahead-replay.service \ systemd-readahead-collect.service fi echo echo "systemd has been installed to /bin/systemd. Please ensure you append" echo "init=/bin/systemd to your kernel command line in your bootloader." echo }