Skip to content

Commit

Permalink
Add an entrypoint script
Browse files Browse the repository at this point in the history
Script will allow you to override config settings
Add a -usenwnscriptcomp flag to default to new nwn script compiler
  • Loading branch information
Ardesco committed Aug 12, 2023
1 parent 3076484 commit a97630d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ RUN nimble install nasher@#${NASHER_VERSION} -y && \
chmod +x /root/.nimble/bin/nasher
ENV PATH="/root/.nimble/bin/:$PATH"
ENV NWN_ROOT="${NWSERVER_DATA_PATH}"
# Configure nasher
RUN nasher config --nssFlags:"-lowkey" && \
nasher config --userName:"nasher" && \
nasher config --packUnchanged true && \
nasher config --abortOnCompileError true

# Configure empty workdir for github to use
RUN mkdir -pv /github/workspace
WORKDIR /github/workspace

# Set default command run by container
ENTRYPOINT [ "nasher" ]
COPY ./entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT [ "entrypoint.sh" ]
CMD [ "--help" ]
36 changes: 36 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

RED='\033[0;31m'
CLS='\033[0m'

DEFAULT_OPTIONS=("--nssFlags:\"-lowkey\"" "--userName:\"nasher\"" "--packUnchanged true" "--abortOnCompileError true")

while [[ $# -gt 0 ]]; do
case $1 in
-option)
ADDITIONAL_OPTIONS+="$2"
shift
shift
;;
-usenwnscriptcomp)
DEFAULT_OPTIONS=("--nssFlags:\"-yc\"" "--nssCompiler:/root/.nimble/bin/nwn_script_comp" "--userName:\"nasher\"" "--packUnchanged true" "--abortOnCompileError true")
shift
;;
*)
NASHER_COMMANDS+=("$1")
shift
;;
esac
done

for OPTION in "${DEFAULT_OPTIONS[@]}"; do
echo -e " ${RED}Setting base config:${CLS} nasher config ${OPTION}"
nasher config "${OPTION}"
done

for OPTION in "${ADDITIONAL_OPTIONS[@]}"; do
echo -e " ${RED}Applying config override:${CLS} nasher config ${OPTION}"
nasher config "${OPTION}"
done

nasher "${NASHER_COMMANDS[@]}"

0 comments on commit a97630d

Please sign in to comment.