23 lines
452 B
Bash
23 lines
452 B
Bash
|
#!/usr/bin/env sh
|
||
|
|
||
|
world=/opt/luanti/worlds/paultopia
|
||
|
moddir=/opt/luanti/mods
|
||
|
|
||
|
|
||
|
while true
|
||
|
do
|
||
|
mods=$(grep -o -E "load_mod_[a-zA-Z0-9\_\-]+ ?= ?true" $world/world.mt | grep -o -E "load_mod_[a-zA-Z0-9\_\-]+")
|
||
|
my_mods="["
|
||
|
c=""
|
||
|
for mod in $mods; do
|
||
|
name=$(echo $mod | sed -e 's/load_mod_//g')
|
||
|
my_mods="$my_mods$c{\"name\":\"$name\"}"
|
||
|
if [ "$c" = "" ]; then
|
||
|
c=","
|
||
|
fi
|
||
|
done
|
||
|
my_mods="$my_mods]"
|
||
|
echo $my_mods | jq > mods.json
|
||
|
sleep 600
|
||
|
done
|