1 |
commit: c0abb42b17e62539099bd65adcf557839ece7c79 |
2 |
Author: tiotags <tiotags1 <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Apr 17 19:03:29 2021 +0000 |
4 |
Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net> |
5 |
CommitDate: Sat Apr 17 19:22:37 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c0abb42b |
7 |
|
8 |
www-servers/hinsightd: added hinsightd http server |
9 |
|
10 |
Package-Manager: Portage-3.0.18, Repoman-3.0.3 |
11 |
Signed-off-by: Alexandru Campeanu <tiotags1 <AT> gmail.com> |
12 |
|
13 |
www-servers/hinsightd/files/gentoo.patch | 28 +++++++++++++ |
14 |
www-servers/hinsightd/files/init.d.sh | 49 +++++++++++++++++++++++ |
15 |
www-servers/hinsightd/hinsightd-9999.ebuild | 61 +++++++++++++++++++++++++++++ |
16 |
www-servers/hinsightd/metadata.xml | 11 ++++++ |
17 |
4 files changed, 149 insertions(+) |
18 |
|
19 |
diff --git a/www-servers/hinsightd/files/gentoo.patch b/www-servers/hinsightd/files/gentoo.patch |
20 |
new file mode 100644 |
21 |
index 000000000..22925c1dc |
22 |
--- /dev/null |
23 |
+++ b/www-servers/hinsightd/files/gentoo.patch |
24 |
@@ -0,0 +1,28 @@ |
25 |
+diff --git a/src/hin/conf.h b/src/hin/conf.h |
26 |
+index c4f7f4c..29b9375 100644 |
27 |
+--- a/src/hin/conf.h |
28 |
++++ b/src/hin/conf.h |
29 |
+@@ -2,9 +2,9 @@ |
30 |
+ #ifndef HIN_CONF_H |
31 |
+ #define HIN_CONF_H |
32 |
+ |
33 |
+-#define HIN_CONF_PATH "workdir/main.lua" |
34 |
+-#define HIN_LOGDIR_PATH "build/" |
35 |
+-#define HIN_CWD_PATH "./" |
36 |
++#define HIN_CONF_PATH "/etc/hinsightd/hinsightd.lua" |
37 |
++#define HIN_LOGDIR_PATH "/var/log/hinsightd/" |
38 |
++#define HIN_CWD_PATH "/var/www/localhost/" |
39 |
+ |
40 |
+ #define HIN_URING_QUEUE_DEPTH 256 |
41 |
+ #define HIN_URING_DONT_FORK 0 |
42 |
+@@ -20,8 +20,8 @@ |
43 |
+ #define HIN_HTTPD_MAX_HEADER_LINE_SIZE 4096 |
44 |
+ #define HIN_HTTPD_MAX_POST_SIZE 4121440 |
45 |
+ #define HIN_HTTPD_MAX_DEFLATE_SIZE 0 |
46 |
+-#define HIN_HTTPD_POST_DIRECTORY "/tmp" |
47 |
+-#define HIN_HTTPD_CACHE_DIRECTORY "/tmp" |
48 |
++#define HIN_HTTPD_POST_DIRECTORY "/var/tmp/hinsightd" |
49 |
++#define HIN_HTTPD_CACHE_DIRECTORY "/var/tmp/hinsightd" |
50 |
+ #define HIN_HTTPD_CACHE_CLEAN_ON_EXIT 1 |
51 |
+ #define HIN_HTTPD_CACHE_TMPFILE 0 |
52 |
+ #define HIN_HTTPD_CACHE_MAX_SIZE 64 * 1024 * 1024 |
53 |
|
54 |
diff --git a/www-servers/hinsightd/files/init.d.sh b/www-servers/hinsightd/files/init.d.sh |
55 |
new file mode 100755 |
56 |
index 000000000..9146de844 |
57 |
--- /dev/null |
58 |
+++ b/www-servers/hinsightd/files/init.d.sh |
59 |
@@ -0,0 +1,49 @@ |
60 |
+#!/sbin/openrc-run |
61 |
+ |
62 |
+NAME=$RC_SVCNAME |
63 |
+RUN_DIR=/var/run/$NAME |
64 |
+LOG_DIR=/var/log/$NAME |
65 |
+TMP_DIR=/var/tmp/$NAME |
66 |
+CWD_DIR=/var/www/localhost |
67 |
+PID_FILE=$RUN_DIR/$NAME.pid |
68 |
+CFG_FILE=/etc/hinsightd/$NAME.lua |
69 |
+ |
70 |
+RUN_FILE=/usr/bin/hinsightd |
71 |
+RUN_USER="hinsightd" |
72 |
+ |
73 |
+extra_commands="checkconfig reload" |
74 |
+ |
75 |
+command=$RUN_FILE |
76 |
+command_args="--config $CFG_FILE --logdir $LOG_DIR --cwd $CWD_DIR --pidfile $PID_FILE --tmpdir $TMP_DIR" |
77 |
+pidfile="$PID_FILE" |
78 |
+command_args_background="--daemonize" |
79 |
+command_user="$RUN_USER:$RUN_USER" |
80 |
+ |
81 |
+depend() { |
82 |
+ use net |
83 |
+} |
84 |
+ |
85 |
+checkconfig() { |
86 |
+ $command $command_args --pretend > /dev/null |
87 |
+} |
88 |
+ |
89 |
+start_pre() { |
90 |
+ checkpath --directory --owner $command_user --mode 0770 $LOG_DIR $TMP_DIR $RUN_DIR |
91 |
+ checkconfig || return 1 |
92 |
+} |
93 |
+ |
94 |
+reload() { |
95 |
+ if ! service_started "${NAME}" ; then |
96 |
+ eerror " * ERROR ${NAME} isn't running" |
97 |
+ return 1 |
98 |
+ fi |
99 |
+ |
100 |
+ checkconfig || return 1 |
101 |
+ |
102 |
+ echo " * Reloading ${NAME} ..." |
103 |
+ |
104 |
+ start-stop-daemon --quiet --signal USR1 --pidfile ${PID_FILE} |
105 |
+ eend $? |
106 |
+} |
107 |
+ |
108 |
+ |
109 |
|
110 |
diff --git a/www-servers/hinsightd/hinsightd-9999.ebuild b/www-servers/hinsightd/hinsightd-9999.ebuild |
111 |
new file mode 100644 |
112 |
index 000000000..e76ea720c |
113 |
--- /dev/null |
114 |
+++ b/www-servers/hinsightd/hinsightd-9999.ebuild |
115 |
@@ -0,0 +1,61 @@ |
116 |
+# Copyright 2021 Gentoo Authors |
117 |
+# Distributed under the terms of the GNU General Public License v2 |
118 |
+ |
119 |
+EAPI=7 |
120 |
+ |
121 |
+LUA_COMPAT=( lua5-{1..4} ) |
122 |
+ |
123 |
+inherit git-r3 fcaps |
124 |
+ |
125 |
+DESCRIPTION="hinsightd a http/1.1 webserver with (hopefully) minimal goals" |
126 |
+HOMEPAGE="https://gitlab.com/tiotags/hin9" |
127 |
+EGIT_REPO_URI="https://gitlab.com/tiotags/hin9.git" |
128 |
+LICENSE="BSD" |
129 |
+SLOT="0" |
130 |
+KEYWORDS="" |
131 |
+IUSE="" #+openssl |
132 |
+ |
133 |
+RDEPEND=" |
134 |
+acct-user/hinsightd |
135 |
+acct-group/hinsightd |
136 |
+sys-libs/liburing |
137 |
+dev-lang/lua:* |
138 |
+sys-libs/zlib |
139 |
+dev-libs/openssl |
140 |
+" |
141 |
+ |
142 |
+DEPEND="${RDEPEND}" |
143 |
+ |
144 |
+BDEPEND=" |
145 |
+acct-user/hinsightd |
146 |
+acct-group/hinsightd |
147 |
+dev-util/ninja |
148 |
+" |
149 |
+ |
150 |
+PATCHES=( |
151 |
+"${FILESDIR}/gentoo.patch" |
152 |
+) |
153 |
+ |
154 |
+#src_configure() { |
155 |
+#} |
156 |
+ |
157 |
+src_compile() { |
158 |
+ cd build |
159 |
+ ninja |
160 |
+} |
161 |
+ |
162 |
+src_install() { |
163 |
+ newbin "${S}/build/hin9 hinsightd" |
164 |
+ newinitd "${FILESDIR}/init.d.sh" hinsightd |
165 |
+ |
166 |
+ insinto /etc/hinsightd |
167 |
+ newins "${S}/workdir/main.lua" hinsightd.lua |
168 |
+ |
169 |
+ keepdir /var/www/localhost/htdocs |
170 |
+ keepdir /var/log/hinsightd |
171 |
+ keepdir /var/tmp/hinsightd |
172 |
+} |
173 |
+ |
174 |
+pkg_postinst() { |
175 |
+ fcaps CAP_NET_BIND_SERVICE /usr/bin/hinsightd |
176 |
+} |
177 |
|
178 |
diff --git a/www-servers/hinsightd/metadata.xml b/www-servers/hinsightd/metadata.xml |
179 |
new file mode 100644 |
180 |
index 000000000..9b48d579b |
181 |
--- /dev/null |
182 |
+++ b/www-servers/hinsightd/metadata.xml |
183 |
@@ -0,0 +1,11 @@ |
184 |
+<?xml version="1.0" encoding="UTF-8"?> |
185 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
186 |
+<pkgmetadata> |
187 |
+ <!-- maintainer-needed --> |
188 |
+ <longdescription lang="en"> |
189 |
+ hinsightd a http/1.1 webserver with (hopefully) minimal goals |
190 |
+ </longdescription> |
191 |
+ <use> |
192 |
+ <!--<flag name="openssl">Enable tls encryption with openssl</flag>--> |
193 |
+ </use> |
194 |
+</pkgmetadata> |