summarylogtreecommitdiffstats
path: root/journey.install
diff options
context:
space:
mode:
authorJonathan Wright2016-01-25 10:02:57 +0000
committerJonathan Wright2016-01-25 10:02:57 +0000
commit9faca721cb13d670ed0204a9eb4cc58edae2b14c (patch)
treed9b5c69ce0f3d0ce8ceb33924918b2737692d7ae /journey.install
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.
Diffstat (limited to 'journey.install')
-rw-r--r--journey.install41
1 files changed, 41 insertions, 0 deletions
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
+}