summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 599433c2c2822d95b931d956ea786df017884c29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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}"
}