Minor Changes.

This commit is contained in:
cyteen 2026-03-16 01:06:21 +00:00
parent eba4a86db4
commit b973b346ad
1 changed files with 21 additions and 22 deletions

View File

@ -3,6 +3,8 @@
declare -A DOCKER_OPT
# This is a complete list of available options as of 2025 but some are empty here,
# They are kept here as reference.
DOCKER_OPT[1]='.["authorization-plugins"] = [] | .["data-root"] = ""'
DOCKER_OPT[2]='.["dns"] = ["52.174.55.168","188.165.200.156"]'
DOCKER_OPT[3]='.["dns-opts"] = []'
@ -72,14 +74,12 @@ DOCKER_OPT[65]='.["default-addresses-pools"] = [{"base":"172.80.0.0/16","size":2
JSON_FILE="daemon.json"
WORKDIR="/tmp"
if [ ! -f ${WORKDIR}/${JSON_FILE} ]
then
if [ ! -f ${WORKDIR}/${JSON_FILE} ]; then
echo "{}" >${WORKDIR}/${JSON_FILE}
else
echo "${WORKDIR}/${JSON_FILE} exists."
fi
# Count through the number of array elements, using ${#
# looking for one missing.
for ((i = 1; i < ${#DOCKER_OPT[@]}; ++i)); do
@ -93,9 +93,8 @@ done
# regardless how it's spelled.
for i in "${!DOCKER_OPT[@]}"; do
OPTION="${DOCKER_OPT[$i]}"
jq "${OPTION}" ${WORKDIR}/${JSON_FILE} > ${WORKDIR}/${JSON_FILE}.new && \
jq "${OPTION}" ${WORKDIR}/${JSON_FILE} >${WORKDIR}/${JSON_FILE}.new &&
mv -b ${WORKDIR}/${JSON_FILE}.new ${WORKDIR}/${JSON_FILE}
done
cat ${WORKDIR}/${JSON_FILE} | jq