aboutsummaryrefslogtreecommitdiffstats
path: root/community/kiwiirc
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2016-08-25 08:11:29 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2016-08-25 08:11:29 +0000
commit0ba8cd0b26bc79feb0bc87fac61255a40eec17d5 (patch)
tree0d9e9616daef2cb81b9e1991d787c3f5d438cb10 /community/kiwiirc
parent0109f4afea388776366a44bb309b0f1af75affb7 (diff)
downloadaports-0ba8cd0b26bc79feb0bc87fac61255a40eec17d5.tar.bz2
aports-0ba8cd0b26bc79feb0bc87fac61255a40eec17d5.tar.xz
community/kiwiirc: moved from testing
Diffstat (limited to 'community/kiwiirc')
-rw-r--r--community/kiwiirc/APKBUILD72
-rw-r--r--community/kiwiirc/kiwiirc.confd5
-rw-r--r--community/kiwiirc/kiwiirc.initd36
-rw-r--r--community/kiwiirc/kiwiirc.pre-install4
-rw-r--r--community/kiwiirc/kiwilauncher.patch24
-rw-r--r--community/kiwiirc/kiwipath.patch156
6 files changed, 297 insertions, 0 deletions
diff --git a/community/kiwiirc/APKBUILD b/community/kiwiirc/APKBUILD
new file mode 100644
index 0000000000..d021c8a0f6
--- /dev/null
+++ b/community/kiwiirc/APKBUILD
@@ -0,0 +1,72 @@
+# Contributor: Francesco Colista <fcolista@alpinelinux.org>
+# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
+pkgname=kiwiirc
+_pkgname=KiwiIRC
+pkgver=0.9.4
+pkgrel=1
+pkgdesc="A hand-crafted webirc client"
+url="https://www.kiwiirc.com/"
+arch="noarch"
+license="AGPL3"
+depends="nodejs>=0.10.0"
+makedepends="nodejs"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc"
+pkgusers="kiwiirc"
+pkggroups="kiwiirc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/prawnsalad/$_pkgname/archive/v$pkgver.tar.gz
+ kiwilauncher.patch
+ kiwipath.patch
+ $pkgname.initd
+ $pkgname.confd"
+
+builddir="$srcdir"/$_pkgname-$pkgver
+build() {
+ cd "$builddir"
+ npm -q install
+ npm -q dedupe
+}
+
+package() {
+ cd "$builddir"
+ install -D -m644 config.example.js $pkgdir/etc/kiwiirc/config.js
+ install -D -m755 kiwi $pkgdir/usr/bin/kiwi
+ install -D -m644 package.json $pkgdir/usr/share/webapps/kiwiirc/package.json
+ install -d -m755 $pkgdir/usr/lib/kiwiirc/server_modules
+ install -d -m755 $pkgdir/var/lib/kiwiirc
+ install -d -m775 $pkgdir/var/run/kiwiirc
+ install -d -m644 $pkgdir/var/log/kiwiirc
+ install -d -m755 $pkgdir/usr/share/webapps/kiwiirc/server
+ install -d -m755 $pkgdir/usr/share/webapps/kiwiirc/node_modules
+
+ cp -a client/* $pkgdir/var/lib/kiwiirc
+ cp -a node_modules $pkgdir/usr/share/webapps/kiwiirc/
+ cp -a server $pkgdir/usr/share/webapps/kiwiirc
+ cp -a server_modules $pkgdir/usr/lib/kiwiirc
+
+ chown -R $pkgusers:$pkggroups "$pkgdir"/etc/kiwiirc
+ chown -R $pkgusers:$pkggroups "$pkgdir"/usr/lib/kiwiirc
+ chown -R $pkgusers:$pkggroups "$pkgdir"/usr/share/webapps/kiwiirc
+ chown -R $pkgusers:$pkggroups "$pkgdir"/var/lib/kiwiirc
+ chown $pkgusers:$pkggroups "$pkgdir"/var/run/kiwiirc
+
+ install -D -m755 $srcdir/$pkgname.initd $pkgdir/etc/init.d/$pkgname
+ install -D -m644 $srcdir/$pkgname.confd $pkgdir/etc/conf.d/$pkgname
+ install -D -m644 LICENSE.txt "$pkgdir"/usr/share/doc/$pkgname/LICENSE.txt
+}
+
+md5sums="1a06e33088ca6ed89f857f7687470761 kiwiirc-0.9.4.tar.gz
+c92dbf55621e1ed5d130c58405b14919 kiwilauncher.patch
+c93b69c4bca4bce7e3e7520b6e9f4588 kiwipath.patch
+182ce4e2d858e97bb796c222c1a38e30 kiwiirc.initd
+372c26f6b491c2a69f4d8fbaff6a598b kiwiirc.confd"
+sha256sums="72d63c3e88b0e510de761b4fd5ee889e77a3df14a8f2aa425bf291f7dafb23dc kiwiirc-0.9.4.tar.gz
+8099343315fadf5fdc84095eba4a2ec53066b36e2f4f51cd871fe95a8fcc1489 kiwilauncher.patch
+5803c819cc35aeeab5b9f69d91afa36f752f9749946cfbbed97fa06d0a444ecd kiwipath.patch
+329ede98f372e0d15bae8a0e6b1210ea27b7fc7607b5cb9e26c82a538e86cfe6 kiwiirc.initd
+73a1ec4ce7b379bd3e121100258ce03c45818ecee331c690d42d7fc991692466 kiwiirc.confd"
+sha512sums="81034d4b1d6af93bd2fbacd302c0780996b87bbf0b936b61abb1ca04fb97939d956bf4704ada63766a4da04feb56957abf141ed74fff02fd7db237b6272a6ac4 kiwiirc-0.9.4.tar.gz
+2b2b61d579fe73ba59c05b3bf9a8ac1bc43225ad414ab34474746731a443c56431ddc9156005a7d3890c65e2344c882d8731c1c36b7a07af0c7014fd4d37e811 kiwilauncher.patch
+1bc8829398d1311384f8411bd65f6231831d2f24728d779f97a99b5e7e46758771c36b5daba215fe6508c728162bfbb22fdaa3be2b44988d59c53804e7005c40 kiwipath.patch
+a0612b562313eaa6eb2f4fafab2d40ce4784685c8a14e57a5eae8c9126cab3370957dc0a56dace370e10ddb02bda01800063baf6fa66b8159d9f99c06ac85c39 kiwiirc.initd
+416b807dee290b0d55020fd980dbf232615f173899d13fe859834cdb61af96a30c5edbeafa35e290cb9d9ed9695ae53abfc876fb4b73687dabfcb3467046a304 kiwiirc.confd"
diff --git a/community/kiwiirc/kiwiirc.confd b/community/kiwiirc/kiwiirc.confd
new file mode 100644
index 0000000000..ebf89cafdd
--- /dev/null
+++ b/community/kiwiirc/kiwiirc.confd
@@ -0,0 +1,5 @@
+# Kiwi IRC facultative paramters
+# -v = verbose
+# -c = config file path
+
+#args="-v"
diff --git a/community/kiwiirc/kiwiirc.initd b/community/kiwiirc/kiwiirc.initd
new file mode 100644
index 0000000000..0d58b4fb49
--- /dev/null
+++ b/community/kiwiirc/kiwiirc.initd
@@ -0,0 +1,36 @@
+#!/sbin/openrc-run
+#
+# Open-RC init.d file for Kiwi IRC
+# Copyright (c) 2016 - Francesco Colista (fcolista@alpinelinux.org)
+
+description="Kiwi IRC Daemon"
+command="/usr/bin/kiwi"
+pidfile="/var/run/kiwiirc/kiwiirc.pid"
+
+depend() {
+ use net
+ after firewall
+}
+
+start() {
+ if ! [ -f /var/lib/kiwiirc/index.html ]; then
+ $command build
+ fi
+ $command start
+ eend $?
+}
+
+stop() {
+ $command stop
+ eend $?
+}
+
+status() {
+ $command status
+ eend $?
+}
+
+build() {
+ $command build
+ eend $?
+}
diff --git a/community/kiwiirc/kiwiirc.pre-install b/community/kiwiirc/kiwiirc.pre-install
new file mode 100644
index 0000000000..53a5edb7dc
--- /dev/null
+++ b/community/kiwiirc/kiwiirc.pre-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+addgroup kiwiirc 2>/dev/null
+adduser -S -H -h /var/lib/kiwiirc -s /sbin/nologin -G kiwiirc kiwiirc 2>/dev/null
+exit 0
diff --git a/community/kiwiirc/kiwilauncher.patch b/community/kiwiirc/kiwilauncher.patch
new file mode 100644
index 0000000000..cdc8545963
--- /dev/null
+++ b/community/kiwiirc/kiwilauncher.patch
@@ -0,0 +1,24 @@
+index a1f1208..47770b6 100644
+--- a/server/helpers/launcher.js
++++ b/server/helpers/launcher.js
+@@ -1,5 +1,5 @@
+ var kiwi_app = '../kiwi.js';
+-var pidfile = '../../kiwiirc.pid';
++var pidfile = '/run/kiwiirc/kiwiirc.pid';
+ var pidfile_arg;
+
+ // Check if a pidfile has been set as an argument
+@@ -16,6 +16,13 @@ if (process.argv.indexOf('-p') > -1) {
+ }
+ }
+
++try {
++ process.setgid('kiwiirc');
++ process.setuid('kiwiirc');
++} catch (e) {
++ console.error('Cannot switch to user kiwiirc. Try running as root.')
++ process.exit();
++}
+
+ var daemon = require('daemonize2').setup({
+ main: kiwi_app,
diff --git a/community/kiwiirc/kiwipath.patch b/community/kiwiirc/kiwipath.patch
new file mode 100644
index 0000000000..41d645b4b9
--- /dev/null
+++ b/community/kiwiirc/kiwipath.patch
@@ -0,0 +1,156 @@
+diff --git a/config.example.js b/config.example.js
+index f432409..1049700 100644
+--- a/config.example.js
++++ b/config.example.js
+@@ -6,7 +6,7 @@ conf.group = "";
+
+
+ // Log file location
+-conf.log = "kiwi.log";
++conf.log = "/var/log/kiwi/kiwiirc.log";
+
+
+
+@@ -53,7 +53,7 @@ conf.identd = {
+
+
+ // Where the client files are
+-conf.public_http = "client/";
++conf.public_http = "/var/lib/kiwiirc/";
+
+ // Transports available to the client.
+ // Behind an Apache reverse proxy? Uncomment the below - Apache does not support websockets!
+@@ -122,7 +122,7 @@ conf.client_plugins = [
+
+
+ // Directory to find the server modules
+-conf.module_dir = "../server_modules/";
++conf.module_dir = "/usr/lib/kiwiirc/server_modules/";
+
+ // Which modules to load
+ conf.modules = [
+diff --git a/kiwi b/kiwi
+index ddcdfdf..dca2dcc 100755
+--- a/kiwi
++++ b/kiwi
+@@ -1,11 +1,6 @@
+ #!/bin/sh
+-basedir=`dirname "$0"`
+
+-case `uname` in
+- *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+-esac
+-
+-$(command -v nodejs || command -v node) $basedir/server/helpers/launcher.js "$@"
++node /usr/share/webapps/kiwiirc/server/helpers/launcher.js "$@"
+ ret=$?
+
+ exit $ret
+diff --git a/server_modules/client_file_watcher.js b/server_modules/client_file_watcher.js
+index 2c3a017..47ad093 100644
+--- a/server_modules/client_file_watcher.js
++++ b/server_modules/client_file_watcher.js
+@@ -6,12 +6,12 @@
+
+ var fs = require('fs');
+ var path = require('path');
+-var kiwiModules = require('../server/modules');
++var kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules');
+
+ var module = new kiwiModules.Module('client_file_watcher');
+
+ // Watch the common stylesheets
+-fs.watch('client/assets/css', alertClients);
++fs.watch('/var/lib/kiwiirc/assets/css', alertClients);
+
+
+ // Watch the theme stylesheets
+diff --git a/server_modules/control.js b/server_modules/control.js
+index d1c9cbf..1e187ec 100644
+--- a/server_modules/control.js
++++ b/server_modules/control.js
+@@ -5,8 +5,8 @@
+ */
+
+ var net = require('net'),
+- kiwiModules = require('../server/modules'),
+- ControlInterface = require('../server/controlinterface.js'),
++ kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules'),
++ ControlInterface = require('/usr/share/webapps/kiwiirc/server/controlinterface.js'),
+ _ = require('lodash'),
+ winston = require('winston');
+
+diff --git a/server_modules/dnsbl.js b/server_modules/dnsbl.js
+index 1a2c718..54a4300 100644
+--- a/server_modules/dnsbl.js
++++ b/server_modules/dnsbl.js
+@@ -5,7 +5,7 @@
+ */
+
+ var dns = require('dns'),
+- kiwiModules = require('../server/modules');
++ kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules');
+
+
+ // The available DNS zones to check against
+diff --git a/server_modules/example.js b/server_modules/example.js
+index d880c19..575dc5f 100644
+--- a/server_modules/example.js
++++ b/server_modules/example.js
+@@ -1,4 +1,4 @@
+-var kiwiModules = require('../server/modules');
++var kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules');
+
+ var module = new kiwiModules.Module('Example Module');
+
+diff --git a/server_modules/force_https.js b/server_modules/force_https.js
+index 9ca8362..512ffed 100644
+--- a/server_modules/force_https.js
++++ b/server_modules/force_https.js
+@@ -4,7 +4,7 @@
+ * Keep users secure by redirecting them to HTTPS if not already
+ */
+
+-var kiwiModules = require('../server/modules');
++var kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules');
+
+ var module = new kiwiModules.Module('force_https');
+
+diff --git a/server_modules/proxychecker.js b/server_modules/proxychecker.js
+index 660defc..7fb96e6 100644
+--- a/server_modules/proxychecker.js
++++ b/server_modules/proxychecker.js
+@@ -5,7 +5,7 @@
+ */
+
+ var util = require('util'),
+- kiwiModules = require('../server/modules');
++ kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules');
+
+
+ var module = new kiwiModules.Module('proxychecker');
+diff --git a/server_modules/stats.js b/server_modules/stats.js
+index 736ba17..a9de440 100644
+--- a/server_modules/stats.js
++++ b/server_modules/stats.js
+@@ -4,7 +4,7 @@
+ * Retreive stats for internal kiwi events. Handy for graphing
+ */
+
+-var kiwiModules = require('../server/modules'),
++var kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules'),
+ fs = require('fs');
+
+
+diff --git a/server_modules/web_agent_debugger.js b/server_modules/web_agent_debugger.js
+index 2358508..ef85e9f 100644
+--- a/server_modules/web_agent_debugger.js
++++ b/server_modules/web_agent_debugger.js
+@@ -6,7 +6,7 @@
+ */
+
+
+-var kiwiModules = require('../server/modules'),
++var kiwiModules = require('/usr/share/webapps/kiwiirc/server/modules'),
+ agent = require('webkit-devtools-agent');
+