-
Notifications
You must be signed in to change notification settings - Fork 27
/
justfile
103 lines (82 loc) · 2.92 KB
/
justfile
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
export PORT := '8081'
export UID := `id -u`
export GID := `id -g`
COMPOSE := 'docker-compose -f docker/app.yml -p archwiki'
COMPOSE-RUN := COMPOSE + ' run --rm'
PHP-DB-RUN := COMPOSE-RUN + ' app'
PHP-RUN := COMPOSE-RUN + ' --no-deps app'
MARIADB-RUN := COMPOSE-RUN + ' -T --no-deps mariadb'
default:
just --list
# Installs MediaWiki and creates LocalSettings.php
init: start
rm -f LocalSettings.php
{{PHP-DB-RUN}} php maintenance/run.php install \
--dbserver "mariadb" \
--dbuser "root" \
--dbpass "" \
--installdbpass "" \
--dbname "archwiki" \
--scriptpath "" \
--pass "adminpassword" \
--server "http://localhost:${PORT}" \
"ArchWiki" \
"admin"
echo -e "\$wgVectorResponsive = true;\n\$wgVectorDefaultSkinVersion = '2';\nwfLoadExtension( 'ArchLinux' );" >> LocalSettings.php
sed -E 's/^(\$wgDefaultSkin\s*=\s*).+/\1"vector-2022";/g' -i LocalSettings.php
echo -e "\$wgArchHome = 'https://www.archlinux.org/';" >> LocalSettings.php
echo -e "\$wgArchNavBar = ['Start' => '#', 'Wiki' => '/'];" >> LocalSettings.php
echo -e "\$wgArchNavBarSelectedDefault = 'Wiki';" >> LocalSettings.php
# Load a (gzipped) database backup for local testing
import-db-dump file name='archwiki': start
{{MARIADB-RUN}} mariadb-admin -uroot -hmariadb --skip-ssl drop -f {{name}} || true
{{MARIADB-RUN}} mariadb-admin -uroot -hmariadb --skip-ssl create {{name}}
zcat {{file}} | {{MARIADB-RUN}} mariadb -uroot -hmariadb --skip-ssl {{name}}
{{PHP-RUN}} php maintenance/run.php update --quick
start:
{{COMPOSE}} up -d
{{MARIADB-RUN}} mariadb-admin -uroot -hmariadb --skip-ssl --wait=10 ping
@echo URL: http://localhost:${PORT}
stop:
{{COMPOSE}} stop
clean:
{{COMPOSE}} down -v
git clean -fdqx -e .idea
rebuild: clean
{{COMPOSE}} build --pull --parallel
just init
just stop
compose *args:
{{COMPOSE}} {{args}}
compose-run *args:
{{COMPOSE-RUN}} {{args}}
php *args='-h':
{{PHP-RUN}} php {{args}}
update version:
#!/usr/bin/env bash
set -euo pipefail
TMPDIR=$(mktemp -d)
version={{version}}
branch=${version%.*}
pushd $TMPDIR >/dev/null
wget https://releases.wikimedia.org/mediawiki/${branch}/mediawiki-{{version}}.tar.gz{,.sig}
gpg --verify-files mediawiki-{{version}}.tar.gz.sig
popd >/dev/null
shopt -s extglob
rm -rf !("justfile"|"favicon.ico"|".gitmodules"|".gitignore"|"sitemaps"|".git"|"docker"|".idea"|"extensions")
pushd extensions >/dev/null
rm -rf !("ArchLinux"|"BounceHandler"|"CheckUser"|"CodeMirror"|"DarkMode"|"FlarumAuth"|"Lockdown"|"TitleKey"|"UserMerge")
popd >/dev/null
shopt -u extglob
tar -xz --strip-components=1 -f $TMPDIR/mediawiki-{{version}}.tar.gz
rm -rf $TMPDIR
git submodule update
git submodule foreach git fetch
git submodule foreach git checkout REL${branch/./_}
git submodule foreach git pull
for module in $(git submodule foreach --quiet 'echo $name'); do
git submodule set-branch --branch REL${branch/./_} "${module}"
done
git add -u
git add .
git commit -am"Update to MediaWiki {{version}}"