sourcemod-sourcebans-pp
LOW
maintainer ChrisTX
0 votes
base
sourcebans-pp
scanned 2026-11-03 12:04:35.126831
Why flagged
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
Triggered rules
Low
Few votes, recently uploaded
zero_votes_recent
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
PKGBUILD
1
# Maintainer: Christian Pfeiffer <cpfeiffer at rev-crew dot info>
2
# shellcheck disable=SC2034,SC2154
3
# shellcheck shell=bash
4
5
pkgbase=sourcebans-pp
6
pkgname=(sourcebans-pp sourcemod-sourcebans-pp)
7
pkgver=2.2.3
8
pkgrel=1
9
pkgdesc="SourceBans++, the admin, ban and communication management of SourceMod game servers"
10
arch=(any)
11
url="https://sbpp.github.io"
12
license=(Elastic-2.0 GPL-3.0-only)
13
# The panel's PHP libraries (Composer, at the lock file's versions; lcobucci/jwt requires sodium),
14
# SourceMod's compiler and include files for the plugins, and SourceMod, which the plugins' package
15
# depends on (makepkg installs the depends of every package of a split PKGBUILD)
16
makedepends=(composer git php php-sodium sourcemod sourcemod-scripting)
17
# A database server for upstream's tests and sourcebans-pp's
18
checkdepends=(mariadb)
19
source=("git+https://github.com/sbpp/sourcebans-pp.git#tag=$pkgver"
20
sourcebans-pp.php
21
nginx.conf.example)
22
sha512sums=('9758c463719adfe1c3115f06026da6034a771814c5c8948547fdb228d86db29ad945b1131b555a35f1446210c8880663cd986d2b4a3f1f14152624344d6c1f85'
23
'b4368cfc69b78a727d31f586068aa65de35741171141ca145c5dcbdaa2d068261cc3f6564ac94a38fb1d94c40bdf2bdda98c4623cdf18e90b716d6b40f3a92bf'
24
'227373db3705b82b2c44d2d2a0ed7916e35d3c40c2381ee67d0397e23bc1ff4796b6d049aeb6674c0e1e7b9323222e74c0fd90639ea8d6899a58932b05682b19')
25
b2sums=('9e69911b790cc681f7b7a8790de16fd2a2bd092369b556eb8a5dd98149601fbbcc56604992291380528c7f4683d35d354603ea6e8e0d3e227a07a938a5efce05'
26
'bb98ddf6ba5111995ac6128c9dc5d787099f4a250ff4ae29fa15b14c25132ed2bd110b47c459f9bd7453ac2da0dffb69966ef4f9b471944b06c083e704dfe2ee'
27
'03f7ce234493a51c3be8b3b5f5b35a287ccbc36f6fbda5b12fabc8bb5608221d9bedc31e291c1838dd4d92c8cf9a2c6df43b357e86313f75c82c20343af1d054')
28
29
prepare() {
30
cd "$pkgbase" || exit
31
32
# The version of the plugins (their include file) and of the panel (configs/version.json), as
33
# upstream's release workflow sets them
34
SBPP_RELEASE_VERSION="$pkgver" bash game/addons/sourcemod/scripting/scripts/resolve-plugin-version.sh
35
printf '{\n "version": "%s",\n "git": "%s",\n "dev": false\n}\n' \
36
"$pkgver" "$(git rev-parse --short HEAD)" >web/configs/version.json
37
38
# Nothing prebuilt: TinyMCE 5.4.2, which nothing loads since the dashboard text's editor was
39
# replaced by Markdown (#1113), and the GeoLite2 Country database, geoipupdate's instead
40
rm -r web/includes/tinymce
41
rm web/data/GeoLite2-Country.mmdb
42
43
# The daily telemetry ping off unless an admin turns it on (Settings, Features): the default of
44
# new installs (data.sql) and of the migration adding it to older ones (807)
45
local _file
46
for _file in web/install/includes/sql/data.sql web/updater/data/807.php; do
47
grep -q "('telemetry.enabled', '1')" "$_file" || exit
48
sed -i "s/('telemetry.enabled', '1')/('telemetry.enabled', '0')/" "$_file"
49
done
50
}
51
52
build() {
53
cd "$pkgbase" || exit
54
55
local _src
56
cd game/addons/sourcemod/scripting || exit
57
for _src in *.sp; do
58
spcomp64 -iinclude -o"../plugins/${_src%.sp}.smx" "$_src"
59
done
60
cd "$srcdir/$pkgbase" || exit
61
62
# The panel's libraries, without the development ones, like upstream's release; the PHP extensions
63
# they require, which Arch's PHP doesn't load by default
64
local _php=(php -d extension=iconv -d extension=sodium)
65
export COMPOSER_HOME="$srcdir/composer"
66
"${_php[@]}" /usr/bin/composer install --working-dir=web --no-dev --optimize-autoloader \
67
--no-interaction --prefer-dist --no-progress
68
}
69
70
check() {
71
# Upstream's tests, with PHPUnit and the other development libraries in a copy of the checkout, as
72
# some of them read files outside the panel
73
rm -rf "$srcdir/test"
74
cp -a "$srcdir/$pkgbase" "$srcdir/test"
75
cd "$srcdir/test/web" || exit
76
# The extensions in an ini file rather than php -d, which the tests PHPUnit runs in processes of
77
# their own don't get
78
mkdir -p "$srcdir/php"
79
printf 'extension=%s\n' iconv pdo_mysql sodium >"$srcdir/php/extensions.ini"
80
export PHP_INI_SCAN_DIR=":$srcdir/php"
81
export COMPOSER_HOME="$srcdir/composer"
82
composer install --no-interaction --prefer-dist --no-progress
83
84
# A MariaDB server of the build's own, on a socket: the tests create their database; sourcebans-pp
85
# sets up one like an install
86
local _db="$srcdir/mariadb"
87
rm -rf "$_db"
88
mariadb-install-db --no-defaults --datadir="$_db/data" --auth-root-authentication-method=normal \
89
--skip-test-db >/dev/null
90
mariadbd --no-defaults --datadir="$_db/data" --socket="$_db/socket" --skip-networking \
91
--pid-file="$_db/pid" --log-error="$_db/error.log" &
92
# Its PID to wait for: a bare wait would also wait for the tee of makepkg's log, forever
93
local _pid=$! _status=0
94
_check_with_mariadb "$_db/socket" || _status=$?
95
kill "$_pid"
96
wait "$_pid" || true
97
return "$_status"
98
}
99
100
_check_with_mariadb() {
101
local _socket=$1 _i
102
for _i in {1..30}; do
103
mariadb-admin --no-defaults --socket="$_socket" -uroot ping &>/dev/null && break
104
sleep 1
105
done
106
mariadb --no-defaults --socket="$_socket" -uroot -e "
107
CREATE USER 'sourcebans'@'localhost' IDENTIFIED BY 'sourcebans';
108
GRANT ALL ON *.* TO 'sourcebans'@'localhost';
109
CREATE DATABASE sourcebans CHARACTER SET utf8mb4;" || return
110
111
printf 'pdo_mysql.default_socket=%s\n' "$_socket" >>"$srcdir/php/extensions.ini"
112
# Without testGitDescribeLeavesTripletAsDevWhenNotExactSemver, which expects git describe of a
113
# development checkout, not of the release tag the package is built from
114
# (https://github.com/sbpp/sourcebans-pp/issues/1613)
115
DB_HOST=localhost includes/vendor/bin/phpunit \
116
--exclude-filter testGitDescribeLeavesTripletAsDevWhenNotExactSemver || return
117
118
# sourcebans-pp setup on an empty database, then again and upgrade, which only check the version;
119
# the admin it creates
120
local _cli=(env SBPP_PANEL_ROOT="$srcdir/test/web" SBPP_SETUP_DIR="$srcdir/test/web"
121
SBPP_CONFIG_PATH="$srcdir/config.php" php "$srcdir/sourcebans-pp.php")
122
rm -f "$srcdir/config.php"
123
DB_HOST=localhost DB_PASS=sourcebans INITIAL_ADMIN_NAME=admin INITIAL_ADMIN_STEAM=STEAM_1:0:1234 \
124
INITIAL_ADMIN_EMAIL=admin@example.com INITIAL_ADMIN_PASSWORD=password1234 \
125
"${_cli[@]}" setup </dev/null >"$srcdir/databases.cfg" || return
126
"${_cli[@]}" setup </dev/null || return
127
"${_cli[@]}" upgrade || return
128
grep -q '"pass" "sourcebans"' "$srcdir/databases.cfg" || return
129
[[ $(mariadb --no-defaults --socket="$_socket" -uroot -N -e \
130
"SELECT authid, extraflags FROM sourcebans.sb_admins WHERE user = 'admin'") == $'STEAM_0:0:1234\t16777216' ]]
131
}
132
133
package_sourcebans-pp() {
134
pkgdesc="SourceBans++, the admin, ban and communication management of SourceMod game servers (web panel)"
135
# The panel (Elastic License 2.0), LightOpenID (MIT) and the PHP libraries: MIT, BSD 3-clause
136
# (nette's under BSD or GPL), Apache 2.0 (maxmind-db/reader), LGPL 3.0 (Smarty), LGPL 2.1
137
# (xpaw/php-source-query-class)
138
license=(Elastic-2.0 MIT BSD-3-Clause Apache-2.0 LGPL-3.0-or-later LGPL-2.1-only)
139
# pdo_mysql (in php) and sodium, enabled in php.ini
140
depends=(php php-sodium)
141
optdepends=(
142
'mariadb: the database server'
143
'php-fpm: a web server with PHP-FPM, like nginx'
144
'geoipupdate: the GeoLite2 Country database of the country flags'
145
)
146
install=sourcebans-pp.install
147
148
local _name=${FUNCNAME[0]#package_} _src="$srcdir/$pkgbase"
149
local _webroot="$pkgdir/usr/share/webapps/$_name"
150
local _state="$pkgdir/var/lib/$_name"
151
152
# The panel in /usr/share/webapps, without its tests and development files, the install wizard and
153
# the updater, which the panel refuses to run next to: they're sourcebans-pp's, outside the web root
154
install -d "$_webroot" "$pkgdir/usr/share/$_name"
155
cp -r --no-preserve=ownership "$_src"/web/. "$_webroot/"
156
rm -r "${_webroot:?}"/{tests,phpstan,bin,demos} \
157
"$_webroot"/{phpstan*.neon,phpstan*.php,phpunit.xml,package.json,package-lock.json} \
158
"$_webroot"/{composer.json,composer.lock,config.php.template}
159
mv "$_webroot"/{install,updater} "$pkgdir/usr/share/$_name/"
160
install -Dm755 "$srcdir/sourcebans-pp.php" "$pkgdir/usr/bin/sourcebans-pp"
161
162
# What the panel writes, in /var/lib for the web server (http): its caches, compiled templates,
163
# uploaded demos, and the map images and game icons, which admins upload next to the shipped ones
164
install -d -o 33 -g 33 -m750 "$_state"/{cache,templates_c,demos}
165
install -d "$_state/images"
166
local _dir
167
for _dir in images/maps images/games; do
168
mv "$_webroot/$_dir" "$_state/$_dir"
169
chown 33:33 "$_state/$_dir"
170
ln -s "/var/lib/$_name/$_dir" "$_webroot/$_dir"
171
done
172
for _dir in cache templates_c demos; do
173
ln -s "/var/lib/$_name/$_dir" "$_webroot/$_dir"
174
done
175
# The configuration sourcebans-pp setup writes, readable by the web server; geoipupdate's GeoLite2
176
# Country database, which the panel skips while it doesn't exist
177
install -d -g 33 -m750 "$pkgdir/etc/webapps/$_name"
178
ln -s "/etc/webapps/$_name/config.php" "$_webroot/config.php"
179
ln -s /var/lib/GeoIP/GeoLite2-Country.mmdb "$_webroot/data/GeoLite2-Country.mmdb"
180
181
install -Dm644 "$srcdir/nginx.conf.example" -t "$pkgdir/usr/share/doc/$_name"
182
local _licenses="$pkgdir/usr/share/licenses/$_name"
183
install -Dm644 "$_src"/{LICENSE.txt,THIRD-PARTY-NOTICES.txt} -t "$_licenses"
184
local _license
185
for _license in "$_src"/web/includes/vendor/*/*/LICENSE*; do
186
_dir=${_license#"$_src"/web/includes/vendor/}
187
install -Dm644 "$_license" "$_licenses/vendor/$_dir"
188
done
189
}
190
191
package_sourcemod-sourcebans-pp() {
192
pkgdesc="SourceBans++, the admin, ban and communication management of SourceMod game servers (SourceMod plugins)"
193
# The plugins: GPL 3.0, sbpp_comms (from SourceComms) GPL 3.0 or later
194
license=(GPL-3.0-only GPL-3.0-or-later)
195
depends=(sourcemod)
196
optdepends=('sourcemod-sourcebans-pp-discord-forward: for bans, comms and reports forwarded to Discord')
197
198
local _name=${FUNCNAME[0]#package_} _src="$srcdir/$pkgbase/game/addons/sourcemod"
199
# In the addons folder of sourcemod: the plugins, their configuration and translations, as in
200
# upstream's package; their include files for other plugins with SourceMod's
201
local _sm="$pkgdir/usr/lib/sourcemod/addons/sourcemod"
202
install -Dm644 "$_src"/plugins/*.smx -t "$_sm/plugins"
203
install -Dm644 "$_src"/configs/sourcebans/* -t "$_sm/configs/sourcebans"
204
install -Dm644 "$_src"/translations/* -t "$_sm/translations"
205
install -Dm644 "$_src"/scripting/include/*.inc -t "$_sm/scripting/include"
206
207
install -Dm644 "$srcdir/$pkgbase/LICENSE-plugins.txt" "$pkgdir/usr/share/licenses/$_name/LICENSE.txt"
208
install -Dm644 "$srcdir/$pkgbase/THIRD-PARTY-NOTICES.txt" -t "$pkgdir/usr/share/licenses/$_name"
209
}
210
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-11-03 12:04:35 | Low | 1 |