summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Wright2016-01-25 10:02:57 +0000
committerJonathan Wright2016-01-25 10:02:57 +0000
commit9faca721cb13d670ed0204a9eb4cc58edae2b14c (patch)
treed9b5c69ce0f3d0ce8ceb33924918b2737692d7ae
downloadaur-9faca721cb13d670ed0204a9eb4cc58edae2b14c.tar.gz
First commit of journey package
This is the first commit to the AUR of the journey package, a blogging engine written in golang and compatible with Ghost themes. This package: - created the user and group "journey" under which the service will run; - downloads and compiles the binary, as well as downloads the initially supplied theme for journey (promenade); and - installs all files under /opt/journey (attempts were make to split it out under /var and /usr with symlinks, but the code at this time doesn't properly deal with symlinks in filesystem searches causing unusual errors). This is the core package which will locally build the binary from the specified version. journey-bin (pre-compiled) and journey-git (latest releases from the develop branch) are also available.
-rw-r--r--.SRCINFO27
-rw-r--r--.gitignore9
-rw-r--r--PKGBUILD66
-rw-r--r--journey.install41
-rw-r--r--journey.service10
5 files changed, 153 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..73807575c884
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,27 @@
+# Generated by mksrcinfo v8
+# Mon Jan 25 10:02:43 UTC 2016
+pkgbase = journey
+ pkgdesc = Ghost-compatible blogging platform written in golang
+ pkgver = 0.1.9
+ pkgrel = 1
+ url = https://kabukky.github.io/journey/
+ install = journey.install
+ arch = i686
+ arch = x86_64
+ license = MIT
+ makedepends = go
+ conflicts = journey-bin
+ conflicts = journey-git
+ options = emptydirs
+ backup = opt/journey/config.json
+ source = https://github.com/kabukky/journey/archive/v0.1.9.tar.gz
+ source = promenade.zip::https://github.com/kabukky/promenade/archive/59388206534e37aeabdbf672ea1a8e1cf93ee09f.zip
+ source = journey.service
+ source = journey.install
+ sha256sums = 9ab101514864bf3ed764ba2e51fc74b17de8b787187fd3aa72cf4df7453529e5
+ sha256sums = 2597207a112f69ec0de94bef063681a6d2f3920fff02c2117e5ccf392a4a1ca4
+ sha256sums = 71ff0fd4afd25bcc9e91fe2f9d9f9b8dd89884081e05c93bbd5f3c4c84b71428
+ sha256sums = 20b809dbe7553acbd940c6bd0a83b6b529d3ebc8fa5c4ac20ae74c1bb7c6b22c
+
+pkgname = journey
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..ead22e05cdfd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# Downloads packages
+/*.tar.gz
+/*.zip
+# Built packages
+/*.tar.xz
+
+# Temporary build directories
+/src
+/pkg
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..eb10197e126d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,66 @@
+# Maintainer: Jonathan Wright <jon@than.io>
+pkgname=journey
+pkgver=0.1.9
+pkgrel=1
+pkgdesc='Ghost-compatible blogging platform written in golang'
+url='https://kabukky.github.io/journey/'
+
+arch=('i686' 'x86_64')
+makedepends=('go')
+conflicts=('journey-bin' 'journey-git')
+license=('MIT')
+
+options=('emptydirs')
+backup=('opt/journey/config.json')
+install='journey.install'
+
+_srcpath='src/github.com/kabukky/journey'
+_promenade_sha='59388206534e37aeabdbf672ea1a8e1cf93ee09f'
+
+source=("https://github.com/kabukky/journey/archive/v${pkgver}.tar.gz"
+ "promenade.zip::https://github.com/kabukky/promenade/archive/${_promenade_sha}.zip"
+ 'journey.service'
+ 'journey.install')
+sha256sums=('9ab101514864bf3ed764ba2e51fc74b17de8b787187fd3aa72cf4df7453529e5'
+ '2597207a112f69ec0de94bef063681a6d2f3920fff02c2117e5ccf392a4a1ca4'
+ '71ff0fd4afd25bcc9e91fe2f9d9f9b8dd89884081e05c93bbd5f3c4c84b71428'
+ '20b809dbe7553acbd940c6bd0a83b6b529d3ebc8fa5c4ac20ae74c1bb7c6b22c')
+
+
+prepare () {
+ if [[ ! -r ${srcdir}/${_srcpath} ]] ; then
+ mkdir -p ${srcdir}/$(dirname ${_srcpath})
+ ln -s ${srcdir}/${pkgname}-${pkgver} ${srcdir}/${_srcpath}
+ fi
+}
+
+build () {
+ export GOPATH="${srcdir}"
+ cd ${srcdir}/${_srcpath}
+ msg2 "Generating..."
+ go generate ./...
+ msg2 "Fetching..."
+ go get -v ./...
+ msg2 "Building..."
+ go build -v -o ${srcdir}/journey-${pkgver}/journey
+ msg2 "Extracting Promenade..."
+ unzip -qu ${srcdir}/promenade.zip -d ${srcdir}
+ cp -ar ${srcdir}/promenade-${_promenade_sha}/* ${srcdir}/journey-${pkgver}/content/themes/promenade/
+}
+
+package() {
+ cd ${srcdir}/journey-${pkgver}
+
+ # Binary, configuration, and service Unit file
+ install -Dm755 journey ${pkgdir}/opt/journey/journey
+ install -Dm644 config.json ${pkgdir}/opt/journey/config.json
+ install -Dm644 ${srcdir}/journey.service ${pkgdir}/usr/lib/systemd/system/journey.service
+ # Licence
+ install -Dm644 LICENSE.md ${pkgdir}/usr/share/licences/${pkgname}/LICENSE.md
+ # Private files for journey's Admin area and the persistant data for the blog
+ cp -ar built-in ${pkgdir}/opt/journey/
+ cp -ar content ${pkgdir}/opt/journey/
+ # Make sure there is absolutly no way the SQLite database can ever make it
+ # into the package and overwrite the local copy during upgrade
+ rm -f ${pkgdir}/opt/journey/content/data/journey.db
+}
diff --git a/journey.install b/journey.install
new file mode 100644
index 000000000000..f749fd2b61e4
--- /dev/null
+++ b/journey.install
@@ -0,0 +1,41 @@
+pre_install() {
+ # Create a system user for journey to run under
+ if [[ ! $(id journey 2>/dev/null) ]]; then
+ /usr/bin/useradd -r -d /usr/lib/journey -s /usr/bin/bash -U -G http journey
+ fi
+}
+
+post_install() {
+ # Fix ownership of files and directories
+ if [[ $(id journey 2>/dev/null) ]]; then
+ chown -R journey:journey /opt/journey
+ fi
+ # Reload to daemon to make sure it finds the service file
+ systemctl daemon-reload
+}
+
+pre_upgrade() {
+ pre_install
+}
+
+post_upgrade() {
+ # Reload systemd for the new/updated service file and restart the service if
+ # it is already running on the system
+ systemctl daemon-reload
+ systemctl condrestart journey.service
+}
+
+pre_remove() {
+ # Stop the service regardless if it is running
+ systemctl stop journey.service
+}
+
+post_remove() {
+ # Remove the user and group
+ if [[ ! $(id journey 2>/dev/null) ]]; then
+ userdel journey
+ groupdel journey
+ fi
+ # Reload systemd for the removed service file
+ systemctl daemon-reload
+}
diff --git a/journey.service b/journey.service
new file mode 100644
index 000000000000..ed8ee2862abd
--- /dev/null
+++ b/journey.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Journey Blogging Platform
+After=network.target
+
+[Service]
+User=journey
+ExecStart=/opt/journey/journey
+
+[Install]
+WantedBy=multi-user.target