aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremias Stotter <jeremias@stotter.eu>2021-12-04 17:41:06 +0100
committerJeremias Stotter <jeremias@stotter.eu>2021-12-04 18:24:19 +0100
commit2df85e68e1d43de499d3ff8283c74ce9a951c2eb (patch)
tree5c618d01dc5ce2c2c176e7935e121e5d6dce2eea
parent787fbeaf737d7f45763836e8d5cfa8d562cda848 (diff)
downloadJBlog-2df85e68e1d43de499d3ff8283c74ce9a951c2eb.tar.gz
JBlog-2df85e68e1d43de499d3ff8283c74ce9a951c2eb.tar.bz2
JBlog-2df85e68e1d43de499d3ff8283c74ce9a951c2eb.zip
Added install target and init files
OpenRC only, service files might be added at some point
-rw-r--r--init/conf.d/jblog14
-rwxr-xr-xinit/init.d/jblog27
-rw-r--r--lighttpd.conf8
-rw-r--r--makefile24
-rw-r--r--pattern.xhtml19
5 files changed, 69 insertions, 23 deletions
diff --git a/init/conf.d/jblog b/init/conf.d/jblog
new file mode 100644
index 0000000..d2a82f1
--- /dev/null
+++ b/init/conf.d/jblog
@@ -0,0 +1,14 @@
+# /etc/conf.d/jblog: configuration for jblog
+
+# command line options
+
+LOGFILE="/var/log/jblog.log"
+# The socket, point the webserver at this
+SOCK="/var/run/jblog/jblog.sock"
+# The pattern file
+PATTERNF="/usr/share/jblog/pattern.xhtml"
+# The base directory, use the same as for your webserver
+BASEDIR="/var/www/localhost"
+USER="www"
+
+JBLOG_OPTS="-l ${LOGFILE} -s ${SOCK} -p ${PATTERNF} -b ${BASEDIR} -u ${USER}"
diff --git a/init/init.d/jblog b/init/init.d/jblog
new file mode 100755
index 0000000..f6c81f7
--- /dev/null
+++ b/init/init.d/jblog
@@ -0,0 +1,27 @@
+#!/sbin/openrc-run
+# Copyright 2021 Jeremias Stotter
+#
+# This file is part of ´JBlog´.
+#
+# ´JBlog´ is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ´JBlog´ is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ´JBlog´. If not, see <http://www.gnu.org/licenses/>.
+
+description="A SCGI Blog server"
+pidfile="/var/run/jblog.pid"
+command="/usr/bin/jblog"
+
+command_args="-d ${JBLOG_OPTS}"
+
+depend() {
+ use net
+}
diff --git a/lighttpd.conf b/lighttpd.conf
index 1f24ec3..3974d04 100644
--- a/lighttpd.conf
+++ b/lighttpd.conf
@@ -1,12 +1,12 @@
-server.document-root = "/home/jeremias/coding/jblog"
+server.document-root = "/var/www/localhost"
server.modules = ( "mod_scgi" )
server.port = 8080
-server.username = "jeremias"
-server.groupname = "jeremias"
+server.username = "lighttpd"
+server.groupname = "lighttpd"
scgi.server = (
- "/" => ( "127.0.0.1" => ( "socket" => "/home/jeremias/coding/jblog/blog.sock",
+ "/" => ( ( "socket" => "/var/run/jblog/jblog.sock",
"check-local" => "disable"
) )
)
diff --git a/makefile b/makefile
index c9cdf6c..e1cfea5 100644
--- a/makefile
+++ b/makefile
@@ -1,5 +1,29 @@
CC=gcc
CFLAGS=-O2 -std=c99 -Wall
+BINDIR=/usr/bin
+INITDIR=/etc/init.d
+CONFDIR=/etc/conf.d
+SHAREDIR=/usr/share/jblog
jblog: jblog.c md.o index.o admin.o
$(CC) $(CFLAGS) jblog.c md.o index.o admin.o -o $@
+
+.PHONY: install
+install: jblog
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(SHAREDIR)
+ install -m 755 jblog $(DESTDIR)$(BINDIR)
+ install -m 644 pattern.xhtml $(DESTDIR)$(SHAREDIR)/pattern.xhtml
+
+.PHONY: install-openrc
+install-openrc: init/init.d/jblog init/conf.d/jblog install
+ mkdir -p $(DESTDIR)$(INITDIR) $(DESTDIR)$(CONFDIR)
+ install -m 755 init/init.d/jblog $(DESTDIR)$(INITDIR)
+ install -m 644 init/conf.d/jblog $(DESTDIR)$(CONFDIR)
+
+.PHONY: uninstall
+uninstall:
+ -rm $(DESTDIR)$(BINDIR)/jblog
+ -rm $(DESTDIR)$(INITDIR)/jblog
+ -rm $(DESTDIR)$(CONFDIR)/jblog
+ -rm $(DESTDIR)$(SHAREDIR)/pattern.xhtml
+ -rmdir $(DESTDIR)$(SHAREDIR)
diff --git a/pattern.xhtml b/pattern.xhtml
index 5aee497..cdc699c 100644
--- a/pattern.xhtml
+++ b/pattern.xhtml
@@ -59,25 +59,6 @@ $TITLE$
<link rel="icon" href="/favicon.ico"/>
</head>
<body>
- <table>
- <tr>
- <th>
- <h1>Blog</h1>
- </th>
- <th width="100%" style="text-align: right">
- <img alt="logo" src="https://jeremias.stotter.eu/logo100.png" />
- </th>
- </tr>
- </table>
- <hr/>
$BLOG$
- <hr/>
-
- <footer>
- <p>Reach me via mail:</p>
- <a href="mailto:jeremias@stotter.eu">Jeremias Stotter</a>
- <a href="https://keys.openpgp.org/vks/v1/by-fingerprint/B95C57F72343A5360089B7AB13A5EE92801215A1">PGP Signature</a>
- <a href="https://www.gentoo.org"><img src="/icons/gentoo-badge.png" alt="Powered by Gentoo" style="float: right;" /></a>
- </footer>
</body>
</html>
Jeremias Stotters git repositories generated by CGIT