# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit autotools #inherit autotools flag-o-matic DESCRIPTION="Lightweight, secure and login like console display manager for X" HOMEPAGE="https://github.com/crakem/xlogin" SRC_URI="https://github.com/crakem/xlogin/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" #SRC_URI="https://github.com/crakem/xlogin/archive/refs/tags/v0.43.0/${P}.tar.gz" LICENSE="GPL-3+" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="pam syslog systemd" #RDEPEND="pam? ( >=sys-libs/pam-1.5.1 ) RDEPEND=" pam? ( sys-libs/pam ) !pam? ( virtual/libcrypt ) syslog? ( virtual/logger ) sys-apps/util-linux x11-apps/xauth" DEPEND="pam? ( sys-libs/pam )" BDEPEND="" src_configure() { #append-ldflags -Wl,-z,relro,-z,now if ! use syslog && ! use systemd; then syslogconf="--without-syslog" else syslogconf="--with-syslog" fi econf \ --sysconfdir=/etc/${PN} \ --bindir=/bin \ $(use_with pam) \ ${syslogconf} } src_install() { emake DESTDIR="${D}" install #dostrip "${D}"/bin/xlogin strip -s "${D}"/bin/xlogin fperms 0750 /bin/xlogin } pkg_preinst() { rm ${D}/etc/xlogin/Xsession-arch if use pam;then mkdir -p ${D}/etc/pam.d cp ${ROOT}/etc/pam.d/login ${D}/etc/pam.d/xlogin fi if use systemd;then servicedir=${D}/etc/systemd/system/getty\@tty7.service.d mkdir -p ${servicedir} mv ${D}/etc/xlogin/xlogin.conf ${servicedir}/. elog "Remember to switch back to multi-user target for using xlogin display manager if you are using now graphical target" elog "systemctl set-default multi-user.target" else rm ${D}/etc/xlogin/xlogin.conf #change vt7 line in /etc/inittab (incluir linea debajor de c6, con c7) if ! grep "^c7" ${ROOT}/etc/inittab >/dev/null; then #do nothing if has c7 elog "Autoadding a c7 line in /etc/inittab for xlogin on vt7" if grep "agetty.*tty6" /etc/inittab >/dev/null; then #agetty sed '/^c6/{p;s/c6\(.*\)$/c7\1 -R -l \/bin\/xlogin/}' ${ROOT}/etc/inittab > ${D}/etc/inittab else #mingetty sed '/^c6/{p;s/c6\(.*\)$/c7\1 --loginprog=\/bin\/xlogin/}' ${ROOT}/etc/inittab > ${D}/etc/inittab fi fi elog "Remember to delete display-manager from your default runlevel if is in use" elog "rc-config delete display-manager default" fi #ebuild don't preserve tar file prop chmod +x ${D}/etc/xlogin/Xsession } pkg_postrm() { if use pam;then #rm ${ROOT}/etc/pam.d/xlogin elog "File leaved in your system: ${ROOT}etc/pam.d/xlogin" fi if use systemd;then #rm ${ROOT}/etc/systemd/system/getty\@tty7.service.d/xlogin.conf #rmdir ${ROOT}/etc/systemd/system/getty\@tty7.service.d elog "File leaved in your system: ${ROOT}etc/systemd/system/getty\@tty7.service.d/xlogin.conf" else elog "Remember to remove/edit your c7 line in ${ROOT}etc/inittab for a complete rollback" fi }