blob: e2799d91dc3f3a7552f39abaa9ae17235d7a95af (
plain) (
blame)
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
|
#!/bin/sh
set -eux
# Generates the portion of `dconfig.cfg` loading all necessary mod files in the
# correct order.
# The script assumes a hierarchy demonstrated by the following example.
# mods/
# 000-pre/
# 001-chars/
# 002-tracks/
# 003-post/
# This allows separation of mods based on category such as characters and
# soundtracks but also serves as a poor man's dependency resolution between
# groups of mods e.g., gameplay mods depending on specific characters. The same
# approach can be used to solve dependency between mods found in the same
# category, prefixing the mods with a sequence of digits *should* solve the
# dependency problem e.g., `000-init-mod`, `001-mod-depending-on-000` and
# `002-mod-depending-on-001`.
# While it shouldn't be hard to support a depth of more than 1 subdirectory, it
# seems impractical to me.
if [ -e dkartconfig.cfg ]; then
rm -- dkartconfig.cfg
fi
cp -- dkartconfig_base.cfg dkartconfig.cfg
# NOTE: `find` does not offer a way to guarantee a desired sort of its output.
find mods -type f -printf 'addfile %p\n' | sort >dkartconfig.cfg
if [ -e mods/index ]; then
rm -rf -- mods/index
fi
printf 'regenerating index...\n'
mkdir -- mods/index
cd -- mods/index
# NOTE: Mods from different categories having the same name are not supported.
# XXX: Please don't use newlines in filenames for the love of god.
find .. -type f -print | while read -r file; do
ln -s "$file" .
done
cd -- -
|