diff options
author | XZS | 2016-07-19 00:53:01 +0200 |
---|---|---|
committer | XZS | 2016-07-19 00:53:01 +0200 |
commit | 662f588667e444a9acef89bf306f7a54d9f1a422 (patch) | |
tree | f4b753e2b82277ea0e478c2d68aba19f29c64939 | |
parent | 6dbbce4faddbf0aa2d79172281f46dbe99be4fcc (diff) | |
download | aur-662f588667e444a9acef89bf306f7a54d9f1a422.tar.gz |
support systemd socket activation
This makes the feeds accessible as a system-wide service started on
demand.
A pull request to incorporate the changes and additions was made to the
upstream project. [1] Should it be accepted, all supplementary files added
in this commit can be removed again.
[1]: https://github.com/tremby/vinefeed/pull/3
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | PKGBUILD | 17 | ||||
-rw-r--r-- | binary.patch | 25 | ||||
-rw-r--r-- | socket-activation.patch | 38 | ||||
-rw-r--r-- | vinefeed.service | 9 | ||||
-rw-r--r-- | vinefeed.socket | 5 |
6 files changed, 102 insertions, 2 deletions
@@ -1,7 +1,7 @@ pkgbase = nodejs-vinefeed pkgdesc = RSS/Atom feed generator for Vine users pkgver = 0.1.0 - pkgrel = 1 + pkgrel = 2 url = http://github.com/tremby/vinefeed arch = any license = GPL @@ -10,7 +10,15 @@ pkgbase = nodejs-vinefeed depends = npm provides = nodejs-vinefeed=0.1.0 conflicts = nodejs-vinefeed + source = vinefeed.service + source = vinefeed.socket + source = binary.patch + source = socket-activation.patch source = nodejs-vinefeed::git+http://github.com/tremby/vinefeed + md5sums = 8e09674dfcf9ba971f2a436bb2c55e1a + md5sums = 7e5a337a2598b938d605d8c49f8984ea + md5sums = ad657d580e728305638c1285dd47d77c + md5sums = e9346c6ee335dff8fc4e28ac6843d2af md5sums = SKIP pkgname = nodejs-vinefeed @@ -1,13 +1,20 @@ _npmname=vinefeed pkgname="nodejs-$_npmname" pkgver=0.1.0 -pkgrel=1 +pkgrel=2 pkgdesc="RSS/Atom feed generator for Vine users" arch=(any) url="http://github.com/tremby/vinefeed" license=('GPL') depends=('nodejs' 'npm') optdepends=() +source=("$_npmname".{service,socket} + 'binary.patch' + 'socket-activation.patch') +md5sums=('8e09674dfcf9ba971f2a436bb2c55e1a' + '7e5a337a2598b938d605d8c49f8984ea' + 'ad657d580e728305638c1285dd47d77c' + 'e9346c6ee335dff8fc4e28ac6843d2af') makedepends+=('git') source+=("${_gitname:=${pkgname%-git}}::${_giturl:-git+$url}") @@ -15,6 +22,12 @@ md5sums+=('SKIP') provides+=("$_gitname=$pkgver") conflicts+=("$_gitname") +prepare() { + cd "$_gitname" + patch -p1 -i ../binary.patch + patch -F3 -p1 -i ../socket-activation.patch +} + pkgver() { cd "$_gitname" grep -Po '(?<="version": ").*(?=")' package.json | tr '\n' '.' @@ -22,6 +35,8 @@ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } package() { + install -Dt "$pkgdir/usr/lib/systemd/user/" "$_npmname".{service,socket} + cd "$_gitname" npm install -g --prefix "$pkgdir/usr" --production rmdir "$pkgdir/usr/etc" diff --git a/binary.patch b/binary.patch new file mode 100644 index 000000000000..58e8fbe1e7ce --- /dev/null +++ b/binary.patch @@ -0,0 +1,25 @@ +From 6c7539765342141914309e9d6f4441a014b18ae7 Mon Sep 17 00:00:00 2001 +From: XZS <d.f.fischer@web.de> +Date: Fri, 15 Jul 2016 13:57:54 +0200 +Subject: [PATCH] declare binary + +This makes it globally accessible after installation through npm. +--- + package.json | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/package.json b/package.json +index 7506238..0d68fcb 100644 +--- a/package.json ++++ b/package.json +@@ -10,5 +10,8 @@ + "minimist": "^1.1.0", + "morgan": "^1.3.2", + "request": "^2.45.0" ++ }, ++ "bin": { ++ "vinefeed": "bin/www" + } + } +-- +2.9.0 diff --git a/socket-activation.patch b/socket-activation.patch new file mode 100644 index 000000000000..042492517ab5 --- /dev/null +++ b/socket-activation.patch @@ -0,0 +1,38 @@ +From 7748985cddfe59a6243fefce4a3f6d8547032ec5 Mon Sep 17 00:00:00 2001 +From: XZS <d.f.fischer@web.de> +Date: Fri, 15 Jul 2016 13:56:11 +0200 +Subject: [PATCH] support socket activation through systemd + +When run as a standalone server, it can be helpful to have vinefeed +activated on demand. +--- + bin/www | 2 +- + package.json | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/bin/www b/bin/www +index 06a579f..58016fb 100755 +--- a/bin/www ++++ b/bin/www +@@ -13,5 +13,5 @@ app.set 'port', process.env.PORT + + console.log "Environment: #{app.get('env')}" + +-server = app.listen app.get('port'), -> ++server = app.listen require('systemd-socket')() || app.get('port'), -> + console.log "Listening on port #{server.address().port}" +diff --git a/package.json b/package.json +index 7506238..43a19b5 100644 +--- a/package.json ++++ b/package.json +@@ -9,6 +9,7 @@ + "feed": "^0.2.6", + "minimist": "^1.1.0", + "morgan": "^1.3.2", +- "request": "^2.45.0" ++ "request": "^2.45.0", ++ "systemd-socket": "^0.0.0" + } + } +-- +2.9.0 diff --git a/vinefeed.service b/vinefeed.service new file mode 100644 index 000000000000..044370f58df8 --- /dev/null +++ b/vinefeed.service @@ -0,0 +1,9 @@ +[Unit] +Description=Vine Atom feed HTTP server + +[Service] +Environment=NODE_ENV=production +ExecStart=/usr/bin/vinefeed + +[Install] +WantedBy=multi-user.target diff --git a/vinefeed.socket b/vinefeed.socket new file mode 100644 index 000000000000..9708c677cf7c --- /dev/null +++ b/vinefeed.socket @@ -0,0 +1,5 @@ +[Socket] +ListenStream=3000 + +[Install] +WantedBy=sockets.target |