summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Wright2016-01-25 10:04:27 +0000
committerJonathan Wright2016-01-25 10:04:27 +0000
commit83b17239d47d17a33760e90efff2131ec9e5b007 (patch)
treec0aef4abb2e63674e46d60a4a36942ca1a036e69
downloadaur-journey-git.tar.gz
First commit of journey-git package
This is the first commit to the AUR of the journey-git 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; - clones the latest version of the develop branch 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 experimental package which uses the latest code in the develop branch. journey (core package, also self-compiled) and journey-bin (pre-compiled) are also available.
-rw-r--r--.SRCINFO28
-rw-r--r--.gitignore10
-rw-r--r--PKGBUILD74
-rw-r--r--journey.install41
-rw-r--r--journey.service10
5 files changed, 163 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..ffac53f1201
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+# Generated by mksrcinfo v8
+# Mon Jan 25 10:04:12 UTC 2016
+pkgbase = journey-git
+ pkgdesc = Ghost-compatible blogging platform written in golang
+ pkgver = 0.1.9.r53.g4ea1480
+ pkgrel = 1
+ url = https://kabukky.github.io/journey/
+ install = journey.install
+ arch = i686
+ arch = x86_64
+ license = MIT
+ makedepends = go
+ provides = journey
+ conflicts = journey
+ conflicts = journey-bin
+ options = emptydirs
+ backup = opt/journey/config.json
+ source = journey-git::git+https://github.com/kabukky/journey/#branch=development
+ source = promenade.zip::https://github.com/kabukky/promenade/archive/59388206534e37aeabdbf672ea1a8e1cf93ee09f.zip
+ source = journey.service
+ source = journey.install
+ sha256sums = SKIP
+ sha256sums = 2597207a112f69ec0de94bef063681a6d2f3920fff02c2117e5ccf392a4a1ca4
+ sha256sums = 71ff0fd4afd25bcc9e91fe2f9d9f9b8dd89884081e05c93bbd5f3c4c84b71428
+ sha256sums = 20b809dbe7553acbd940c6bd0a83b6b529d3ebc8fa5c4ac20ae74c1bb7c6b22c
+
+pkgname = journey-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..44e140d4303
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+# Downloads packages
+/journey-git
+/*.tar.gz
+/*.zip
+# Built packages
+/*.tar.xz
+
+# Temporary build directories
+/src
+/pkg
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..4bd7aff8e5b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,74 @@
+# Maintainer: Jonathan Wright <jon@than.io>
+pkgname=journey-git
+pkgver=0.1.9.r53.g4ea1480
+pkgrel=1
+pkgdesc='Ghost-compatible blogging platform written in golang'
+url='https://kabukky.github.io/journey/'
+
+arch=('i686' 'x86_64')
+makedepends=('go')
+conflicts=('journey' 'journey-bin')
+provides=("${pkgname%-git}")
+license=('MIT')
+
+options=('emptydirs')
+backup=('opt/journey/config.json')
+install='journey.install'
+
+_srcpath='src/github.com/kabukky/journey'
+_promenade_sha='59388206534e37aeabdbf672ea1a8e1cf93ee09f'
+
+source=("${pkgname}::git+https://github.com/kabukky/journey/#branch=development"
+ "promenade.zip::https://github.com/kabukky/promenade/archive/${_promenade_sha}.zip"
+ 'journey.service'
+ 'journey.install')
+sha256sums=('SKIP'
+ '2597207a112f69ec0de94bef063681a6d2f3920fff02c2117e5ccf392a4a1ca4'
+ '71ff0fd4afd25bcc9e91fe2f9d9f9b8dd89884081e05c93bbd5f3c4c84b71428'
+ '20b809dbe7553acbd940c6bd0a83b6b529d3ebc8fa5c4ac20ae74c1bb7c6b22c')
+
+pkgver () {
+ cd "${pkgname}"
+ ( set -o pipefail
+ git describe --long --tags 2>/dev/null | sed -e 's/^v//' -e 's/\([^-]*-g\)/r\1/;s/-/./g' ||
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+ )
+}
+
+prepare () {
+ if [[ ! -r ${srcdir}/${_srcpath} ]] ; then
+ mkdir -p ${srcdir}/$(dirname ${_srcpath})
+ ln -s ${srcdir}/${pkgname} ${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}/${pkgname}/journey
+ msg2 "Extracting Promenade..."
+ unzip -qu ${srcdir}/promenade.zip -d ${srcdir}
+ cp -ar ${srcdir}/promenade-${_promenade_sha}/* ${srcdir}/${pkgname}/content/themes/promenade/
+}
+
+package() {
+ cd ${srcdir}/${pkgname}
+
+ # 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 00000000000..f749fd2b61e
--- /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 00000000000..ed8ee2862ab
--- /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