# $Id$ PNAME="systemd" PVER="36" PBUILD="r1" PCATEGORIE="sys-apps" DESCRIPTION="System and Session Manager." HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd" # enable sysvinit support atm for compatibility reasons # y=yes, n=no SYSVINIT_SUPPORT="n" DEPEND=">= sys-apps/dbus-1.4 >= sys-fs/udev-172 >= dev-libs/dbus-glib-0.94 >= sys-apps/tcp-wrappers-7.6 >= sys-libs/pam-1.1 >= sys-libs/libcap-2.20 >= sys-apps/util-linux-2.19 >= sys-apps/shadow-4.1 >= sys-apps/sysvinit-tools-2.88" if [[ ${SYSVINIT_SUPPORT} = y ]] then DEPEND="${DEPEND} >= sys-apps/sysvinit-2.88" fi SDEPEND=">= app-text/docbook-xsl-stylesheets-1.76 >= x11-libs/gtk2+-2.24 >= 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}-33-magellan.patch mirror://${PNAME}/${PNAME}-33-magellan-configurable-getty-4.patch mirror://${PNAME}/login-manager.pamd ) UP2DATE="updatecmd http://www.freedesktop.org/software/systemd/ | lasttarball" src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # apply our magellan patch mpatch ${PNAME}-33-magellan.patch || die # magellan-only: use a configurable getty mpatch ${PNAME}-33-magellan-configurable-getty-4.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() { 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 } preinstall() { 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() { # 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 }