mirror of
https://github.com/moparisthebest/arch-ppa
synced 2024-11-24 09:32:19 -05:00
add kiwiirc
This commit is contained in:
parent
1a3e02b593
commit
1ac473c02c
56
src/kiwiirc/PKGBUILD
Normal file
56
src/kiwiirc/PKGBUILD
Normal file
@ -0,0 +1,56 @@
|
||||
# Maintainer: Jack Allnutt <jack@allnutt.eu>
|
||||
pkgname=kiwiirc
|
||||
pkgver=0.9.4
|
||||
pkgrel=1
|
||||
pkgdesc="A hand-crafted web-based IRC client that you can enjoy"
|
||||
arch=('any')
|
||||
url="https://kiwiirc.com/"
|
||||
license=('AGPL3')
|
||||
depends=('nodejs>=4.0.0', 'npm')
|
||||
makedepends=('git')
|
||||
options=('emptydirs' '!strip')
|
||||
install='kiwiirc.install'
|
||||
backup=('etc/kiwiirc/config.js')
|
||||
source=(https://github.com/prawnsalad/KiwiIRC/archive/v$pkgver.tar.gz
|
||||
'kiwi.patch'
|
||||
'kiwiirc.service'
|
||||
'kiwiirc.conf.sysusers'
|
||||
'kiwiirc.conf.tmpfiles')
|
||||
md5sums=('1a06e33088ca6ed89f857f7687470761'
|
||||
'14a75cab7c10f2dd17856ab5a99d3bfc'
|
||||
'bcb28ddb7f0bcc3be830b8045969eb2c'
|
||||
'593da856bcf9036bc51380b74d9df394'
|
||||
'803080337de27be8921edd76f15c763c')
|
||||
|
||||
build() {
|
||||
cp kiwiirc.service "$srcdir/KiwiIRC-$pkgver/"
|
||||
cp kiwiirc.conf.sysusers "$srcdir/KiwiIRC-$pkgver/"
|
||||
cp kiwiirc.conf.tmpfiles "$srcdir/KiwiIRC-$pkgver/"
|
||||
cd "$srcdir/KiwiIRC-$pkgver"
|
||||
git apply --whitespace=fix ../kiwi.patch
|
||||
npm -q install
|
||||
npm -q dedupe
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir"
|
||||
install -D -m644 KiwiIRC-$pkgver/config.example.js $pkgdir/etc/kiwiirc/config.js
|
||||
install -D -m755 KiwiIRC-$pkgver/kiwi $pkgdir/usr/bin/kiwi
|
||||
install -D -m644 KiwiIRC-$pkgver/kiwiirc.service $pkgdir/usr/lib/systemd/system/kiwiirc.service
|
||||
install -D -m644 KiwiIRC-$pkgver/man/kiwiirc.1 $pkgdir/usr/share/man/man1/kiwi.1
|
||||
install -D -m644 KiwiIRC-$pkgver/package.json $pkgdir/usr/share/kiwiirc/package.json
|
||||
install -D -m644 KiwiIRC-$pkgver/README.md $pkgdir/usr/share/kiwiirc/README.md
|
||||
install -D -m644 KiwiIRC-$pkgver/kiwiirc.conf.sysusers $pkgdir/usr/lib/sysusers.d/kiwiirc.conf
|
||||
install -D -m644 KiwiIRC-$pkgver/kiwiirc.conf.tmpfiles $pkgdir/usr/lib/tmpfiles.d/kiwiirc.conf
|
||||
|
||||
install -d -m755 $pkgdir/usr/lib/kiwiirc/server_modules
|
||||
install -d -m755 $pkgdir/var/lib/kiwiirc
|
||||
install -d -m644 $pkgdir/var/log/kiwiirc
|
||||
install -d -m755 $pkgdir/usr/share/kiwiirc/server
|
||||
install -d -m755 $pkgdir/usr/share/kiwiirc/node_modules
|
||||
|
||||
cp -dr --preserve=mode KiwiIRC-$pkgver/client/* $pkgdir/var/lib/kiwiirc
|
||||
cp -dr --preserve=mode KiwiIRC-$pkgver/node_modules $pkgdir/usr/share/kiwiirc/
|
||||
cp -dr --preserve=mode KiwiIRC-$pkgver/server $pkgdir/usr/share/kiwiirc
|
||||
cp -dr --preserve=mode KiwiIRC-$pkgver/server_modules $pkgdir/usr/lib/kiwiirc
|
||||
}
|
195
src/kiwiirc/kiwi.patch
Normal file
195
src/kiwiirc/kiwi.patch
Normal file
@ -0,0 +1,195 @@
|
||||
config.example.js | 6 +++---
|
||||
kiwi | 7 +------
|
||||
server/helpers/launcher.js | 9 ++++++++-
|
||||
server_modules/client_file_watcher.js | 4 ++--
|
||||
server_modules/control.js | 4 ++--
|
||||
server_modules/dnsbl.js | 2 +-
|
||||
server_modules/example.js | 2 +-
|
||||
server_modules/force_https.js | 2 +-
|
||||
server_modules/proxychecker.js | 2 +-
|
||||
server_modules/stats.js | 2 +-
|
||||
server_modules/web_agent_debugger.js | 2 +-
|
||||
11 files changed, 21 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/config.example.js b/config.example.js
|
||||
index 452b13c..57ad499 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/kiwiirc/server/helpers/launcher.js "$@"
|
||||
ret=$?
|
||||
|
||||
exit $ret
|
||||
diff --git a/server/helpers/launcher.js b/server/helpers/launcher.js
|
||||
index d25a3a3..bff8623 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/server_modules/client_file_watcher.js b/server_modules/client_file_watcher.js
|
||||
index 2c3a017..d0601ae 100644
|
||||
--- a/server_modules/client_file_watcher.js
|
||||
+++ b/server_modules/client_file_watcher.js
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
-var kiwiModules = require('../server/modules');
|
||||
+var kiwiModules = require('/usr/share/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/kiwiirc/server/modules'),
|
||||
+ ControlInterface = require('/usr/share/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/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/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/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/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/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/kiwiirc/server/modules'),
|
||||
agent = require('webkit-devtools-agent');
|
||||
|
||||
|
25
src/kiwiirc/kiwi.patch.2
Normal file
25
src/kiwiirc/kiwi.patch.2
Normal file
@ -0,0 +1,25 @@
|
||||
diff --git a/server/helpers/launcher.js b/server/helpers/launcher.js
|
||||
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,
|
1
src/kiwiirc/kiwiirc.conf.sysusers
Normal file
1
src/kiwiirc/kiwiirc.conf.sysusers
Normal file
@ -0,0 +1 @@
|
||||
u kiwiirc - "Kiwi IRC User"
|
2
src/kiwiirc/kiwiirc.conf.tmpfiles
Normal file
2
src/kiwiirc/kiwiirc.conf.tmpfiles
Normal file
@ -0,0 +1,2 @@
|
||||
R /run/kiwiirc - kiwiirc kiwiirc - -
|
||||
D /run/kiwiirc - kiwiirc kiwiirc - -
|
26
src/kiwiirc/kiwiirc.install
Normal file
26
src/kiwiirc/kiwiirc.install
Normal file
@ -0,0 +1,26 @@
|
||||
post_install() {
|
||||
systemd-sysusers
|
||||
systemd-tmpfiles --create /usr/lib/tmpfiles.d/kiwiirc.conf
|
||||
|
||||
chown -R kiwiirc:kiwiirc /etc/kiwiirc
|
||||
chown -R kiwiirc:kiwiirc /usr/lib/kiwiirc
|
||||
chown -R kiwiirc:kiwiirc /usr/share/kiwiirc
|
||||
chown -R kiwiirc:kiwiirc /var/lib/kiwiirc
|
||||
|
||||
setcap CAP_NET_BIND_SERVICE=+pe /usr/bin/node
|
||||
|
||||
sudo -u kiwiirc kiwi build
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
}
|
||||
|
||||
pre_remove() {
|
||||
systemctl disable kiwiirc.service
|
||||
systemd-tmpfiles --remove /usr/lib/tmpfiles.d/kiwiirc.conf
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
rm -rf /var/lib/kiwiirc/
|
||||
}
|
19
src/kiwiirc/kiwiirc.service
Normal file
19
src/kiwiirc/kiwiirc.service
Normal file
@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=Kiwi IRC web client
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=kiwiirc
|
||||
Group=kiwiirc
|
||||
Type=forking
|
||||
ProtectSystem=full
|
||||
ReadWriteDirectories=/var/lib/kiwiirc /var/log/kiwiirc /run/kiwiirc
|
||||
ReadOnlyDirectories=/usr/share/kiwiirc
|
||||
ExecStart=/usr/bin/kiwi start -p %t/kiwiirc/kiwiirc.pid
|
||||
ExecStop=/usr/bin/kiwi stop -p %t/kiwiirc/kiwiirc.pid
|
||||
ExecReload=/usr/bin/kiwi reconfig -p %t/kiwiirc/kiwiirc.pid
|
||||
PIDFile=%t/kiwiirc/kiwiirc.pid
|
||||
SuccessExitStatus=SIGTERM 0 143
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user