diff options
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | PKGBUILD | 114 | ||||
-rw-r--r-- | matrix-appservice-irc-externalsasl-git.install | 37 |
4 files changed, 179 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..e30ac9454bee --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = matrix-appservice-irc-externalsasl-git + pkgdesc = Node.js IRC bridge for Matrix, patched with external SASL authentication + pkgver = r3223.8a631622 + pkgrel = 1 + url = https://github.com/Francesco149/matrix-appservice-irc/tree/external-sasl + install = matrix-appservice-irc-externalsasl-git.install + arch = any + license = Apache-2.0 + makedepends = git + makedepends = npm + makedepends = python + depends = nodejs + optdepends = python-urllib3: for grant-ops-in-room.py, migrate-users.py, remove-idle-users.py and remove-user.py + optdepends = python-requests: for grant-ops-in-room.py, migrate-users.py, remove-idle-users.py and remove-user.py + optdepends = python-yaml: for grant-ops-in-room.py, migrate-users.py and remove-user.py + provides = matrix-appservice-irc + conflicts = matrix-appservice-irc + backup = etc/matrix-appservice-irc/config.yaml + backup = etc/matrix-appservice-irc/provisioning.rules.yaml + source = git+https://github.com/Francesco149/matrix-appservice-irc.git#branch=external-sasl + sha256sums = SKIP + +pkgname = matrix-appservice-irc-externalsasl-git + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..4508b52af9a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/bim +*.tar.zst +/pkg +/src diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..599433c2c282 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,114 @@ +# Maintainer: Franc[e]sco <lolisamurai@tfwno.gf> + +_pkgbase=matrix-appservice-irc +pkgname=${_pkgbase}-externalsasl-git +pkgver=r3223.8a631622 +pkgrel=1 +pkgdesc='Node.js IRC bridge for Matrix, patched with external SASL authentication' +arch=('any') +license=('Apache-2.0') +depends=('nodejs') +conflicts=("$_pkgbase") +provides=("matrix-appservice-irc") +makedepends=('git' 'npm' 'python') +optdepends=('python-urllib3: for grant-ops-in-room.py, migrate-users.py, remove-idle-users.py and remove-user.py' + 'python-requests: for grant-ops-in-room.py, migrate-users.py, remove-idle-users.py and remove-user.py' + 'python-yaml: for grant-ops-in-room.py, migrate-users.py and remove-user.py') +backup=("etc/${_pkgbase}/config.yaml" "etc/${_pkgbase}/provisioning.rules.yaml") +install=${pkgname}.install +url='https://github.com/Francesco149/matrix-appservice-irc/tree/external-sasl' +source=("git+https://github.com/Francesco149/matrix-appservice-irc.git#branch=external-sasl") +sha256sums=('SKIP') + +pkgver() { + cd "$srcdir/$_pkgbase" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd "$srcdir/$_pkgbase" + sed -e " + s!\./provisioning\.rules\.yaml!/etc/$_pkgbase/provisioning.rules.yaml!g; + s!\(debug\|errors\)\.log!/etc/$_pkgbase/&!g; + s!passkey\.pem!/etc/$_pkgbase/&!g; + s!postgres://username:password@host:port/databasename!nedb:///etc/$_pkgbase/$_pkgbase.db!g; + " -i config.sample.yaml +} + +build() { + cd "$srcdir/$_pkgbase" + npm install --cache "${srcdir}"/npm-cache +} + +package() { + cd "$srcdir/$_pkgbase" + # removing unneeded files and directories + find node_modules -type f \ + \( \ + -iname '*Makefile*' -o \ + -iname '*appveyor.yml' -o \ + -iname '*.babelrc' -o \ + -iname '*.bak' -o \ + -iname '*bower.json' -o \ + -iname '*.c' -o \ + -iname '*.cc' -o \ + -iname '*.cpp' -o \ + -iname '*.md' -o \ + -iname '*.markdown' -o \ + -iname '*.rst' -o \ + -iname '*.nycrc' -o \ + -iname '*.npmignore' -o \ + -iname '*.editorconfig' -o \ + -iname '*.el' -o \ + -iname '*.eslintignore' -o \ + -iname '*.eslintrc*' -o \ + -iname '*.fimbullinter.yaml' -o \ + -iname '*.gitattributes' -o \ + -iname '*.gitmodules' -o \ + -iname '*.h' -o \ + -iname '*.html' -o \ + -iname '*.jshintrc' -o \ + -iname '*.jscs.json' -o \ + -iname '*.log' -o \ + -iname '*logo.svg' -o \ + -iname '*.nvmrc' -o \ + -iname '*.o' -o \ + -iname '*package-lock.json' -o \ + -iname '*.travis.yml' -o \ + -iname '*.prettierrc' -o \ + -iname '*.sh' -o \ + -iname '*.tags*' -o \ + -iname '*.tm_properties' -o \ + -iname '*.wotanrc.yaml' -o \ + -iname '*tsconfig.json' -o \ + -iname '*yarn.lock' \ + \) \ + -delete + find node_modules -type d \ + \( \ + -iwholename '*.github' -o \ + -iwholename '*.tscache' -o \ + -iwholename '*/man' -o \ + -iwholename '*/test' -o \ + -iwholename '*/scripts' -o \ + -iwholename '*/git-hooks' \ + \) \ + -exec rm -rvf {} + + find node_modules -empty -type d -delete + install -vdm 755 "${pkgdir}/usr/lib/node_modules/${_pkgbase}/" + # copy vendored modules, lib and entry point + cp -av {lib,node_modules,app.js,config.schema.yml} "${pkgdir}/usr/lib/node_modules/${_pkgbase}/" + # configuration + install -vDm 640 config.sample.yaml "${pkgdir}/etc/${_pkgbase}/config.yaml" + install -vDm 640 provisioning.rules.sample.yaml \ + "${pkgdir}/etc/${_pkgbase}/provisioning.rules.yaml" + # python scripts + install -vDm 755 scripts/{grant-ops-in-room,migrate-users,remove-idle-users,remove-user}.py \ + -t "${pkgdir}/usr/bin" + # add nodejs based scripts (which are location dependent) + install -vDm 755 scripts/{migrate-db-to-pgres.sh,unbridge.js} \ + -t "${pkgdir}/usr/lib/node_modules/${_pkgbase}/scripts" + # docs + install -vDm 644 {CHANGELOG,CONTRIBUTING,HOWTO,README}.md \ + -t "${pkgdir}/usr/share/doc/${_pkgbase}" +} diff --git a/matrix-appservice-irc-externalsasl-git.install b/matrix-appservice-irc-externalsasl-git.install new file mode 100644 index 000000000000..041602670f73 --- /dev/null +++ b/matrix-appservice-irc-externalsasl-git.install @@ -0,0 +1,37 @@ +post_install() { + echo "Your config files are at /etc/matrix-appservice-irc . + +Set up external sasl authentication for the irc server you will be connecting to. Here's how to do +it on freenode: https://freenode.net/kb/answer/certfp + +Edit /etc/matrix-appservice-irc/config.yaml : + - saslType to EXTERNAL + - sasl to true + - ssl to true + - key and cert to the ones you set up in the previous step + +It's recommended to install matrix-appservice-irc-runit if you use runit which will +install a service that automatically initializes the bridge and starts it. + +If you can't use the runit package, here's how to set up the bridge yourself: + +Run this once to generate your registration file + + sudo node /usr/lib/node_modules/matrix-appservice-irc/app.js \\ + --config /etc/matrix-appservice-irc/config.yaml \\ + --file /etc/matrix-appservice-irc/registration.yaml \\ + --generate-registration --url 'http://localhost:9999' \\ + --localpart irc_bot + +Edit your homeserver config and add the registration.yaml, for synapse it would be: + + app_service_config_files: + - /etc/matrix-appservice-irc/registration.yaml + +Now you can start the bridge: + + sudo node /usr/lib/node_modules/matrix-appservice-irc/app.js \\ + --config /etc/matrix-appservice-irc/config.yaml \\ + --file /etc/matrix-appservice-irc/registration.yaml +" +} |