Use https by default
[gentoo.git] / sys-apps / qingy / qingy-1.0.0-r2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 inherit autotools elisp-common eutils pam systemd
7
8 GENTOO_THEME_VERSION=2.1
9
10 DESCRIPTION="a DirectFB getty replacement"
11 HOMEPAGE="http://qingy.sourceforge.net/"
12 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2
13         mirror://gentoo/${PN}-gentoo-theme-${GENTOO_THEME_VERSION}.tar.bz2
14         https://dev.gentoo.org/~gienah/2big4tree/sys-apps/qingy/${P}-screensavers.patch.gz
15         https://dev.gentoo.org/~gienah/2big4tree/sys-apps/qingy/${P}-consolekit-pam.patch.gz"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="amd64 ppc x86"
20 IUSE="consolekit crypt directfb emacs gpm opensslcrypt pam static X"
21
22 RDEPEND=">=sys-libs/ncurses-5.7-r7:=
23         opensslcrypt? ( dev-libs/openssl:0= )
24         crypt? ( >=dev-libs/libgcrypt-1.2.1:0= )
25         directfb? ( >=dev-libs/DirectFB-1.4.2[fbcon,jpeg,png,truetype] )
26         emacs? ( virtual/emacs )
27         pam? ( >=sys-libs/pam-0.75-r11 )
28         X? (
29                 x11-libs/libX11:=
30                 x11-libs/libXScrnSaver:=
31                 x11-proto/scrnsaverproto
32         )"
33 DEPEND="${RDEPEND}
34         >=sys-apps/sed-4.1.4-r1
35         virtual/pkgconfig"
36 RDEPEND="${RDEPEND}
37         consolekit? (
38                 sys-auth/consolekit
39                 sys-apps/dbus )
40         pam? ( sys-auth/pambase )"
41
42 SITEFILE=50${PN}-gentoo.el
43
44 src_prepare() {
45         epatch "${FILESDIR}"/${P}-tinfo.patch
46         # bug #359637 and bug #462634 - fixes from upstream
47         epatch "${DISTDIR}"/${P}-screensavers.patch.gz
48         # bug #372675 - fix from upstream
49         epatch "${DISTDIR}"/${P}-consolekit-pam.patch.gz
50         eautoreconf
51 }
52
53 src_configure() {
54         local crypto_support="--disable-crypto"
55         local emacs_support="--disable-emacs --without-lispdir"
56
57         if use crypt && use opensslcrypt; then
58                 echo
59                 ewarn "You can have openssl or libgcrypt as a crypto library, not both."
60                 ewarn "Using libgcrypt now..."
61                 echo
62         fi
63
64         use emacs && emacs_support="--enable-emacs --with-lispdir=${SITELISP}/${PN}"
65         use opensslcrypt && crypto_support="--enable-crypto=openssl"
66         use crypt && crypto_support="--enable-crypto=libgcrypt"
67         econf \
68                 --sbindir=/sbin \
69                 --disable-optimizations \
70                 $(use_enable consolekit) \
71                 $(use_enable pam) \
72                 $(use_enable static static-build) \
73                 $(use_enable gpm gpm-lock) \
74                 $(use_enable X x-support) \
75                 $(use_enable directfb DirectFB-support ) \
76                 ${crypto_support} \
77                 ${emacs_support}
78 }
79
80 src_install() {
81         # Copy documentation manually as make install only installs info files
82         # INSTALL is left because it contains also configuration informations
83         dodoc AUTHORS ChangeLog INSTALL NEWS README THANKS TODO
84
85         # Install the program
86         emake DESTDIR="${D}" install
87
88         # Set the settings file umask to 600, in case somebody
89         # wants to make use of the autologin feature
90         /bin/chmod 600 "${D}"/etc/qingy/settings
91
92         # Install Gentoo theme
93         dodir /usr/share/${PN}/themes/gentoo
94         cp "${WORKDIR}"/gentoo/* "${D}"/usr/share/${PN}/themes/gentoo || die
95
96         # Alter config file so that it uses our theme
97         sed -i 's/theme = "default"/theme = "gentoo"/' "${D}"/etc/${PN}/settings
98
99         # Install log rotation policy
100         insinto /etc/logrotate.d
101         newins "${FILESDIR}"/${PN}-logrotate ${PN}
102
103         use emacs && elisp-site-file-install "${FILESDIR}"/${SITEFILE}
104
105         rm "${D}"/etc/pam.d/qingy
106         pamd_mimic system-local-login qingy auth account password session
107
108         systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service"
109 }
110
111 pkg_postinst() {
112         einfo "In order to use qingy you must first edit your /etc/inittab"
113         einfo "Check the documentation at ${HOMEPAGE}"
114         einfo "for instructions on how to do that."
115         echo
116         einfo "Also, make sure to adjust qingy settings file (/etc/qingy/settings)"
117         einfo "to your preferences/machine configuration..."
118
119         if use crypt; then
120                 echo
121                 einfo "You will have to create a key pair using 'qingy-keygen'"
122                 echo
123                 ewarn "Note that sometimes a generated key-pair may pass the internal tests"
124                 ewarn "but fail to work properly. You will get a 'regenerate your keys'"
125                 ewarn "message. If this is your case, please remove /etc/qingy/public_key"
126                 ewarn "and /etc/qingy/private_key and run qingy-keygen again..."
127         fi
128
129         use emacs && echo && elisp-site-regen
130 }
131
132 pkg_postrm() {
133         use emacs && elisp-site-regen
134 }