-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·67 lines (53 loc) · 2.18 KB
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·67 lines (53 loc) · 2.18 KB
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
#!/bin/bash
set -eo pipefail
MW=/var/www/html
SENTINEL="$MW/images/.mw-installed"
SETTINGS_SRC=/etc/mediawiki/LocalSettings.php
if [ -z "$MW_ADMIN_PASSWORD" ]; then
echo "[entrypoint] ERROR: MW_ADMIN_PASSWORD is not set" >&2
exit 1
fi
first_run() {
echo "[entrypoint] First run — installing MediaWiki"
# installer refuses to run if LocalSettings.php exists
rm -f "$MW/LocalSettings.php"
php "$MW/maintenance/install.php" \
--dbserver="$MEDIAWIKI_DB_HOST" \
--dbname="$MEDIAWIKI_DB_NAME" \
--dbuser="$MEDIAWIKI_DB_USER" \
--dbpass="$MEDIAWIKI_DB_PASSWORD" \
--server="${MW_SERVER:-http://localhost}" \
--scriptpath="" \
--pass="$MW_ADMIN_PASSWORD" \
"altered.wiki" "Admin"
# replace installer-generated LocalSettings.php with ours
cp "$SETTINGS_SRC" "$MW/LocalSettings.php"
echo "[entrypoint] Running database update"
php "$MW/maintenance/run.php" update --quick
echo "[entrypoint] Initializing Semantic MediaWiki"
php "$MW/extensions/SemanticMediaWiki/maintenance/setupStore.php"
echo "[entrypoint] Configuring CirrusSearch"
php "$MW/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php"
php "$MW/extensions/CirrusSearch/maintenance/ForceSearchIndex.php"
echo "[entrypoint] Setting system messages"
echo "know what you're taking" \
| php "$MW/maintenance/run.php" edit --user="Admin" --summary="Initial setup" \
"MediaWiki:Citizen-footer-desc"
echo "Psychoactive substances documented by the people who know them." \
| php "$MW/maintenance/run.php" edit --user="Admin" --summary="Initial setup" \
"MediaWiki:Citizen-footer-tagline"
echo "-" \
| php "$MW/maintenance/run.php" edit --user="Admin" --summary="Initial setup" \
"MediaWiki:Aboutsite"
touch "$SENTINEL"
echo "[entrypoint] Setup complete"
}
if [ ! -f "$SENTINEL" ]; then
first_run
else
# upgrade path: sync LocalSettings and apply any schema changes
cp "$SETTINGS_SRC" "$MW/LocalSettings.php"
echo "[entrypoint] Running database update"
php "$MW/maintenance/run.php" update --quick
fi
exec docker-php-entrypoint "$@"