Browse code

update screen without hardcoded socketdir

Hanno Böck authored on02/03/2020 11:14:59
Showing4 changed files
... ...
@@ -1,5 +1,8 @@
1
-AUX screen-4.3.0-no-utempter.patch 363 BLAKE2B 2230c4cd52687f12f3cfd095f9d24d95fb2ec5fba283b60234779ad805d7caed740edc0ac6811b9e210483519be034c5cd799671d1fe0a4e0da1fe78ae6a305f SHA512 0b2e6a2b54e6155e217ab44a0d8314afafd97fae684fbc2875c0f4d21df29cb259ea4023343e92da16dd3a2bf11ec6d06e677d765748299d1633aa1b9261a604
1
+AUX screen-4.3.0-no-utempter.patch 341 BLAKE2B 3339783b3574f82f093c82a613ad18c5c58c184c082c2c311281cdd57e7176abae0f5935466a4a8b4d931d1d1b93d8f0a4e6b558a268553af4a0170061e6ebfe SHA512 f4191ba1ecac3076f958f56309c0a1d523b455fa4e3388f1cfca59c8ccff0afdfb20ef18d54794ba539b2b6d1511ed599dc44787344dc5ccce2902c9b9848155
2
+AUX screen-4.6.2-utmp-exit.patch 1558 BLAKE2B e08e83f8b9f0cd09cd9bad4486a75d71bd899a7917954702ece0837099639079a746138374cbeaf71072cca64ae36a3c2a32250123c6747089e724272227e0dd SHA512 0e7c6c224f6fb8e01650b778cb2b155942752504dc97112d9594b7fa0da1bb8bd828240a2519b1c21f1c162181da89a8daa51ef7f74c8ced0b85cdb3e911a67c
2 3
 AUX screenrc 10412 BLAKE2B f4866f4a83b22c37484b66e4c7d52ec479fe12ae3e72e5c9e769b1b543ecf04d14ef4339e1c72064741cbf39502ef82d3beb213326a30889f128e135f60bd528 SHA512 06fbec5e28480a2c369330fac0c94faa47e5d28e037d9fefd0cb3e813002c504866dc8ac86872b7ac6f16059a219e396a9c425b578b8afe882153ddb506158f7
3 4
 DIST screen-4.6.1.tar.gz 848979 BLAKE2B e78874b6d8723c52f827ab5e6b665102d7fd831f03a0006f9d31e000535ccce95ce08e2d302e34ba2d567167a917c8bd3b875843828d1951bcb38ab6ae4e0acf SHA512 e5d029400ed5b509ebddc1f55812c33536d6f5ce91119537c7d06e1fa7dee84939c43337df4638f61c818ce0412f4d08fe212202162a4483a9e84bbc4b3e4336
5
+DIST screen-4.8.0.tar.gz 854854 BLAKE2B 97ef6f18bf2c63c477260b742ac0b3501f112d380c41ccecc5cf2853db853cc62d4fd6d37edeca35fb41a43b76d98a5cfe160749c992d284f9764b0a0fdcc778 SHA512 770ebaf6ee9be711bcb8a6104b3294f2bf4523dae6683fdc5eac4b3aff7e511be2d922b6b2ad28ec241113c2e4fe0d80f9a482ae1658adc19c8c3a3680caa25c
4 6
 EBUILD screen-4.6.1.ebuild 4112 BLAKE2B f29b4bd4c38caca89c6137d9a355dce966bda306cc23117ffe3246a862eb5d1aaf317d4ef921073d0eff59466f5b25c3d7f90df77ae9bc4895d838bf62e4fa21 SHA512 d722c1c97dae37033f3e3ff24b2840a7cd04329936b4112a067765282fe384cec86f7616075d2605f60621376b66095685a2ac75a439815b35132df8b3f787be
7
+EBUILD screen-4.8.0.ebuild 4072 BLAKE2B acc81a0ed1b2857a92b9ea420661dcecce26e45419e5063316a2adde6220c92b9aea01a11e322f24fc80404643034cf7085c6c1c6ab107da5f758985c0294611 SHA512 ab3dca130902eafc1bb4629e327b4ed0d470116b46f8f03c7ec7186615b292c2aa946152af2a80a0aac71368295ea50990a00fdc62e9f2f96e943408f5bd25fb
5 8
 MISC metadata.xml 1836 BLAKE2B 4625e11b8c3120b23e613e14d03ac88b505b412be97270159c881f56ebf674c78274a8dcf199d69ea91f6438d2661635ebbbf38fdc7ebebe8dd6e2ff88f4c6d7 SHA512 e327b61501e6b496045d552851db574b519a99f56c9203c3376b886808a422f8e4aab23b667bcab0d1388ba7ea781c9c9e9f1d07b1426f113119c60cd70d0bcf
... ...
@@ -1,5 +1,5 @@
1
-+++ screen-4.3.0/configure.ac
1
+--- a/configure.ac
2 2
 @@ -878,11 +878,6 @@
3 3
  #include <utmp.h>
4 4
  #endif
5 5
new file mode 100644
... ...
@@ -0,0 +1,55 @@
1
+From 2f1b9dfe03133c9b77ea450aed088d65128dc547 Mon Sep 17 00:00:00 2001
2
+From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= <amade@asmblr.net>
3
+Date: Tue, 5 Apr 2016 12:47:08 +0200
4
+Subject: [PATCH] check if we have ut_exit in utmpx struct
5
+
6
+---
7
+ acconfig.h   | 5 +++++
8
+ configure.ac | 4 ++++
9
+ utmp.c       | 2 ++
10
+ 3 files changed, 11 insertions(+)
11
+
12
+diff --git a/acconfig.h b/acconfig.h
13
+index 656e117..d173c9c 100644
14
+--- a/acconfig.h
15
+@@ -215,6 +215,11 @@
16
+ #undef HAVE_UTEMPTER
17
+ 
18
+ /*
19
++ * Define if your utmpx has ut_exit struct
20
++ */
21
++#undef HAVE_UT_EXIT
22
++
23
++/*
24
+  * If your system has the calls setreuid() and setregid(),
25
+  * define HAVE_SETREUID. Otherwise screen will use a forked process to
26
+  * safely create output files without retaining any special privileges.
27
+diff --git a/configure.ac b/configure.ac
28
+index 1a75020..8457619 100644
29
+--- a/configure.ac
30
+@@ -374,6 +374,10 @@ if test "$have_utempter" = yes; then
31
+   AC_DEFINE(HAVE_UTEMPTER)
32
+   LIBS="$LIBS -lutempter"
33
+ fi
34
++AC_CHECKING(ut_exit)
35
++AC_TRY_COMPILE([
36
++#include <utmpx.h>
37
++],[struct utmpx u; u.ut_exit.e_exit;], AC_DEFINE(HAVE_UT_EXIT))
38
+ 
39
+ dnl
40
+ dnl    ****  signal handling  ****
41
+diff --git a/utmp.c b/utmp.c
42
+index da8d7ff..c864d07 100644
43
+--- a/utmp.c
44
+@@ -381,7 +381,7 @@ static int pututslot(slot_t slot, struct utmpx *u, char *host, Window *win)
45
+ struct utmp *u;
46
+ {
47
+   u->ut_type = DEAD_PROCESS;
48
+-#if (!defined(linux) || defined(EMPTY)) && !defined(__CYGWIN__)
49
++#if defined(HAVE_UT_EXIT)
50
+   u->ut_exit.e_termination = 0;
51
+   u->ut_exit.e_exit = 0;
52
+ #endif
0 53
new file mode 100644
... ...
@@ -0,0 +1,155 @@
1
+# Copyright 1999-2020 Gentoo Authors
2
+# Distributed under the terms of the GNU General Public License v2
3
+
4
+EAPI=7
5
+
6
+inherit autotools flag-o-matic pam tmpfiles toolchain-funcs
7
+
8
+DESCRIPTION="screen manager with VT100/ANSI terminal emulation"
9
+HOMEPAGE="https://www.gnu.org/software/screen/"
10
+
11
+if [[ "${PV}" != 9999 ]] ; then
12
+	SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
13
+	KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
14
+else
15
+	inherit git-r3
16
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/screen.git"
17
+	EGIT_CHECKOUT_DIR="${WORKDIR}/${P}" # needed for setting S later on
18
+	S="${WORKDIR}"/${P}/src
19
+fi
20
+
21
+LICENSE="GPL-2"
22
+SLOT="0"
23
+IUSE="debug nethack pam selinux multiuser"
24
+
25
+CDEPEND="
26
+	>=sys-libs/ncurses-5.2:0=
27
+	pam? ( sys-libs/pam )"
28
+RDEPEND="${CDEPEND}
29
+	acct-group/utmp
30
+	selinux? ( sec-policy/selinux-screen )"
31
+DEPEND="${CDEPEND}
32
+	sys-apps/texinfo"
33
+
34
+PATCHES=(
35
+	# Don't use utempter even if it is found on the system.
36
+	"${FILESDIR}"/${PN}-4.3.0-no-utempter.patch
37
+	"${FILESDIR}"/${PN}-4.6.2-utmp-exit.patch
38
+)
39
+
40
+src_prepare() {
41
+	default
42
+
43
+	# sched.h is a system header and causes problems with some C libraries
44
+	mv sched.h _sched.h || die
45
+	sed -i '/include/ s:sched.h:_sched.h:' screen.h || die
46
+
47
+	# Fix manpage.
48
+	sed -i \
49
+		-e "s:/usr/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
50
+		-e "s:/usr/local/screens:${EPREFIX}/tmp/screen:g" \
51
+		-e "s:/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
52
+		-e "s:/etc/utmp:${EPREFIX}/var/run/utmp:g" \
53
+		-e "s:/local/screens/S\\\-:${EPREFIX}/tmp/screen/S\\\-:g" \
54
+		doc/screen.1 || die
55
+
56
+	if [[ ${CHOST} == *-darwin* ]] || use elibc_musl ; then
57
+		sed -i -e '/^#define UTMPOK/s/define/undef/' acconfig.h || die
58
+	fi
59
+
60
+	# disable musl dummy headers for utmp[x]
61
+	use elibc_musl && append-cppflags "-D_UTMP_H -D_UTMPX_H"
62
+
63
+	# reconfigure
64
+	eautoreconf
65
+}
66
+
67
+src_configure() {
68
+	append-cppflags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}"
69
+
70
+	if [[ ${CHOST} == *-solaris* ]] ; then
71
+		# enable msg_header by upping the feature standard compatible
72
+		# with c99 mode
73
+		append-cppflags -D_XOPEN_SOURCE=600
74
+	fi
75
+
76
+	use nethack || append-cppflags "-DNONETHACK"
77
+	use debug && append-cppflags "-DDEBUG"
78
+
79
+	local myeconfargs=(
80
+		--with-sys-screenrc="${EPREFIX}/etc/screenrc"
81
+		--with-pty-mode=0620
82
+		--with-pty-group=5
83
+		--enable-rxvt_osc
84
+		--enable-telnet
85
+		--enable-colors256
86
+		$(use_enable pam)
87
+	)
88
+	econf "${myeconfargs[@]}"
89
+}
90
+
91
+src_compile() {
92
+	LC_ALL=POSIX emake comm.h term.h
93
+	emake osdef.h
94
+
95
+	emake -C doc screen.info
96
+	default
97
+}
98
+
99
+src_install() {
100
+	local DOCS=(
101
+		README ChangeLog INSTALL TODO NEWS* patchlevel.h
102
+		doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps}
103
+	)
104
+
105
+	emake DESTDIR="${D}" SCREEN="${P}" install
106
+
107
+	local tmpfiles_perms tmpfiles_group
108
+
109
+	if use multiuser || use prefix ; then
110
+		fperms 4755 /usr/bin/${P}
111
+		tmpfiles_perms="0755"
112
+		tmpfiles_group="root"
113
+	else
114
+		fowners root:utmp /usr/bin/${P}
115
+		fperms 2755 /usr/bin/${P}
116
+		tmpfiles_perms="0775"
117
+		tmpfiles_group="utmp"
118
+	fi
119
+
120
+	newtmpfiles - screen.conf <<<"d /tmp/screen ${tmpfiles_perms} root ${tmpfiles_group}"
121
+
122
+	insinto /usr/share/${PN}
123
+	doins terminfo/{screencap,screeninfo.src}
124
+
125
+	insinto /etc
126
+	doins "${FILESDIR}"/screenrc
127
+
128
+	pamd_mimic_system screen auth
129
+
130
+	dodoc "${DOCS[@]}"
131
+}
132
+
133
+pkg_postinst() {
134
+	if [[ -z ${REPLACING_VERSIONS} ]]
135
+	then
136
+		elog "Some dangerous key bindings have been removed or changed to more safe values."
137
+		elog "We enable some xterm hacks in our default screenrc, which might break some"
138
+		elog "applications. Please check /etc/screenrc for information on these changes."
139
+	fi
140
+
141
+	# Add /tmp/screen in case it doesn't exist yet. This should solve
142
+	# problems like bug #508634 where tmpfiles.d isn't in effect.
143
+	local rundir="${EROOT}/tmp/${PN}"
144
+	if [[ ! -d ${rundir} ]] ; then
145
+		if use multiuser || use prefix ; then
146
+			tmpfiles_group="root"
147
+		else
148
+			tmpfiles_group="utmp"
149
+		fi
150
+		mkdir -m 0775 "${rundir}"
151
+		chgrp ${tmpfiles_group} "${rundir}"
152
+	fi
153
+
154
+	ewarn "This revision changes the screen socket location to ${rundir}"
155
+}