Added support for directories in MODS

#871
This commit is contained in:
Geoff Bourne 2021-05-12 20:41:28 -05:00
parent 34ae93f379
commit 589a9aa3db
2 changed files with 10 additions and 5 deletions

View file

@ -1136,10 +1136,12 @@ To use this option pass the environment variable `MODPACK`, such as
top level of the zip archive. Make sure the jars are compatible with the
particular `TYPE` of server you are running.
You may also download individual mods using the `MODS` environment variable and supplying the URL or path
to the jar files. Multiple mods/plugins should be comma separated.
You may also download or copy over individual mods using the `MODS` environment variable. `MODS` contains a comma-separated list of
- URL of a jar file
- container path to a jar file
- container path to a directory containing jar files
docker run -d -e MODS=https://www.example.com/mods/mod1.jar,https://www.example.com/mods/mod2.jar ...
docker run -d -e MODS=https://www.example.com/mods/mod1.jar,/plugins/common,/plugins/special/mod2.jar ...
### Remove old mods/plugins

View file

@ -91,15 +91,18 @@ if [[ "$MODS" ]]; then
exit 2
fi
fi
elif [[ "$i" =~ .*\.jar ]]; then
elif [[ -f "$i" && "$i" =~ .*\.jar ]]; then
log "Copying plugin located at $i ..."
out_file=$(basename "$i")
if ! cp "$i" "${out_dir}/$out_file"; then
log "ERROR: failed to copy from $i into $out_dir"
exit 2
fi
elif [[ -d "$i" ]]; then
log "Copying plugin jars from $i ..."
cp "$i"/*.jar "${out_dir}"
else
log "ERROR Invalid URL or Path given in MODS: $i"
log "ERROR Invalid URL or path given in MODS: $i"
exit 2
fi
done