1 |
commit: 3dbde04e29dfaf1ea68daa7e7ac995655395c1aa |
2 |
Author: Patrice Clement <monsieurp <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 21 08:35:59 2016 +0000 |
4 |
Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 21 08:36:12 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3dbde04e |
7 |
|
8 |
www-misc/shellinabox: add systemd support. |
9 |
|
10 |
Gentoo-Bug: https://bugs.gentoo.org/586450 |
11 |
|
12 |
Package-Manager: portage-2.2.28 |
13 |
|
14 |
www-misc/shellinabox/files/shellinaboxd.service | 14 +++ |
15 |
www-misc/shellinabox/shellinabox-2.19-r1.ebuild | 111 ++++++++++++++++++++++++ |
16 |
2 files changed, 125 insertions(+) |
17 |
|
18 |
diff --git a/www-misc/shellinabox/files/shellinaboxd.service b/www-misc/shellinabox/files/shellinaboxd.service |
19 |
new file mode 100644 |
20 |
index 00000000..1915b0c |
21 |
--- /dev/null |
22 |
+++ b/www-misc/shellinabox/files/shellinaboxd.service |
23 |
@@ -0,0 +1,14 @@ |
24 |
+[Unit] |
25 |
+Description=Shell In A Box daemon |
26 |
+Documentation=man:shellinaboxd(1) |
27 |
+After=network.target nss-lookup.target |
28 |
+ |
29 |
+[Service] |
30 |
+EnvironmentFile=/etc/conf.d/shellinaboxd |
31 |
+WorkingDirectory=/usr/share/shellinabox-resources |
32 |
+ExecStart=/usr/sbin/shellinaboxd ${SIAB_DISABLE_SSL} --port=${SIAB_HTTP_PORT} --user=${SIAB_USER} --group=${SIAB_GROUP} --service=${SIAB_SERVICE} |
33 |
+Restart=on-failure |
34 |
+ |
35 |
+[Install] |
36 |
+WantedBy=multi-user.target |
37 |
+ |
38 |
|
39 |
diff --git a/www-misc/shellinabox/shellinabox-2.19-r1.ebuild b/www-misc/shellinabox/shellinabox-2.19-r1.ebuild |
40 |
new file mode 100644 |
41 |
index 00000000..6bb4ca7 |
42 |
--- /dev/null |
43 |
+++ b/www-misc/shellinabox/shellinabox-2.19-r1.ebuild |
44 |
@@ -0,0 +1,111 @@ |
45 |
+# Copyright 1999-2016 Gentoo Foundation |
46 |
+# Distributed under the terms of the GNU General Public License v2 |
47 |
+# $Id$ |
48 |
+ |
49 |
+EAPI=5 |
50 |
+ |
51 |
+AUTOTOOLS_AUTORECONF="yes" |
52 |
+AUTOTOOLS_IN_SOURCE_BUILD="yes" |
53 |
+ |
54 |
+inherit user autotools-utils systemd |
55 |
+ |
56 |
+DESCRIPTION="Export command line tools to a web based terminal emulator" |
57 |
+HOMEPAGE="https://github.com/shellinabox/shellinabox" |
58 |
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.zip -> ${P}.zip" |
59 |
+ |
60 |
+LICENSE="GPL-2" |
61 |
+SLOT="0" |
62 |
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" |
63 |
+IUSE="+ssl +pam" |
64 |
+ |
65 |
+RDEPEND="${DEPEND}" |
66 |
+DEPEND="${RDEPEND} |
67 |
+ ssl? ( dev-libs/openssl:0= ) |
68 |
+ pam? ( virtual/pam )" |
69 |
+ |
70 |
+SIAB_CERT_DIR="/etc/shellinabox/cert" |
71 |
+SIAB_SSL_BASH="${SIAB_CERT_DIR}/gen_ssl_cert.bash" |
72 |
+SIAB_DAEMON="${PN}d" |
73 |
+ |
74 |
+shellinbox_gen_ssl_setup() { |
75 |
+ read -r -d '' SIAB_SSL_SETUP << EOF |
76 |
+cd ${SIAB_CERT_DIR} |
77 |
+openssl genrsa -des3 -out server.key 1024 |
78 |
+openssl req -new -key server.key -out server.csr |
79 |
+cp server.key server.key.org |
80 |
+openssl rsa -in server.key.org -out server.key |
81 |
+openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt |
82 |
+cat server.crt server.key > certificate.pem |
83 |
+EOF |
84 |
+} |
85 |
+ |
86 |
+pkg_setup() { |
87 |
+ enewgroup "${SIAB_DAEMON}" |
88 |
+ enewuser "${SIAB_DAEMON}" -1 -1 -1 "${SIAB_DAEMON}" |
89 |
+} |
90 |
+ |
91 |
+src_configure() { |
92 |
+ local myeconf="--disable-runtime-loading" |
93 |
+ |
94 |
+ econf \ |
95 |
+ $(use_enable ssl) \ |
96 |
+ $(use_enable pam) \ |
97 |
+ "${myeconf}" |
98 |
+} |
99 |
+ |
100 |
+src_install() { |
101 |
+ emake DESTDIR="${D}" install || die |
102 |
+ |
103 |
+ # make installs the binary in bin. |
104 |
+ rm -rf "${D}/usr/bin" || die |
105 |
+ |
106 |
+ # whereas it should put it in sbin. |
107 |
+ dosbin "${SIAB_DAEMON}" |
108 |
+ |
109 |
+ # Install init+conf files. |
110 |
+ newinitd "${FILESDIR}/${SIAB_DAEMON}.init" "${SIAB_DAEMON}" |
111 |
+ newconfd "${FILESDIR}/${SIAB_DAEMON}.conf" "${SIAB_DAEMON}" |
112 |
+ |
113 |
+ # Install systemd unit files |
114 |
+ systemd_dounit "${FILESDIR}"/shellinaboxd.service |
115 |
+ |
116 |
+ # Install CSS files. |
117 |
+ insinto "/usr/share/${PN}-resources" |
118 |
+ doins -r "${PN}"/*.css |
119 |
+ |
120 |
+ if use ssl; then |
121 |
+ # Create directory where SSL certificates will be generated. |
122 |
+ dodir "${SIAB_CERT_DIR}" |
123 |
+ fowners "${SIAB_DAEMON}:${SIAB_DAEMON}" "${SIAB_CERT_DIR}" |
124 |
+ |
125 |
+ # Generate set up variable. |
126 |
+ shellinbox_gen_ssl_setup |
127 |
+ |
128 |
+ # Dump it in a bash script. |
129 |
+ echo "#!/usr/bin/env bash" > "${D}/${SIAB_SSL_BASH}" || die |
130 |
+ echo "${SIAB_SSL_SETUP}" >> "${D}/${SIAB_SSL_BASH}" || die |
131 |
+ chmod +x "${D}/${SIAB_SSL_BASH}" || die |
132 |
+ fi |
133 |
+} |
134 |
+ |
135 |
+pkg_postinst() { |
136 |
+ ewarn |
137 |
+ ewarn "The default configuration exposes a login shell" |
138 |
+ ewarn "with SSL disabled on the localhost interface only." |
139 |
+ ewarn |
140 |
+ |
141 |
+ if use ssl; then |
142 |
+ shellinbox_gen_ssl_setup |
143 |
+ |
144 |
+ einfo |
145 |
+ einfo "To generate self-signed SSL certificates" |
146 |
+ einfo "please read the following procedure" |
147 |
+ einfo "explained here: https://code.google.com/p/shellinabox/issues/detail?id=59#c15" |
148 |
+ einfo |
149 |
+ einfo "${SIAB_SSL_SETUP}" |
150 |
+ einfo |
151 |
+ einfo "This walkthrough has been written in ${SIAB_SSL_BASH} for your convenience." |
152 |
+ einfo "Make sure to execute this script." |
153 |
+ einfo |
154 |
+ fi |
155 |
+} |