DOCKERD_CONF="/tmp/dockerd/daemon.json"
uci_quiet() {
- uci -q ${@} >/dev/null
+ uci -q "${@}" >/dev/null
}
json_add_array_string() {
- json_add_string "" "$1"
+ json_add_string "" "${1}"
}
boot() {
}
uciupdate() {
- local net="$1"
+ local net="${1}"
uci -q get network.docker >/dev/null || {
logger -t "dockerd-init" -p warn "No network uci config section for docker default bridge (docker0) found"
return
}
- [ -z "$net" ] && {
+ [ -z "${net}" ] && {
logger -t "dockerd-init" -p notice "Removing network uci config options for docker default bridge (docker0)"
uci_quiet delete network.docker.netmask
uci_quiet delete network.docker.ipaddr
return
}
- eval "$(ipcalc.sh "$net")"
- logger -t "dockerd-init" -p notice "Updating network uci config option \"$net\" for docker default bridge (docker0)"
- uci_quiet set network.docker.netmask="$NETMASK"
- uci_quiet set network.docker.ipaddr="$IP"
+ eval "$(ipcalc.sh "${net}")"
+ logger -t "dockerd-init" -p notice "Updating network uci config option \"${net}\" for docker default bridge (docker0)"
+ uci_quiet set network.docker.netmask="${NETMASK}"
+ uci_quiet set network.docker.ipaddr="${IP}"
uci_quiet commit network
}
process_config() {
local alt_config_file data_root log_level bip
- rm -f "$DOCKERD_CONF"
+ rm -f "${DOCKERD_CONF}"
[ -f /etc/config/dockerd ] || {
# Use the daemon default configuration
config_load 'dockerd'
config_get alt_config_file globals alt_config_file
- [ -n "$alt_config_file" ] && [ -f "$alt_config_file" ] && {
- ln -s "$alt_config_file" "$DOCKERD_CONF"
+ [ -n "${alt_config_file}" ] && [ -f "${alt_config_file}" ] && {
+ ln -s "${alt_config_file}" "${DOCKERD_CONF}"
return 0
}
. /usr/share/libubox/jshn.sh
json_init
- json_add_string "data-root" "$data_root"
- json_add_string "log-level" "$log_level"
- [ -z "$bip" ] || json_add_string "bip" "$bip"
+ json_add_string "data-root" "${data_root}"
+ json_add_string "log-level" "${log_level}"
+ [ -z "${bip}" ] || json_add_string "bip" "${bip}"
json_add_array "registry-mirrors"
config_list_foreach globals registry_mirrors json_add_array_string
json_close_array
json_close_array
mkdir -p /tmp/dockerd
- json_dump > "$DOCKERD_CONF"
+ json_dump > "${DOCKERD_CONF}"
- uciupdate "$bip"
+ uciupdate "${bip}"
}
start_service() {
procd_open_instance
procd_set_param stderr 1
- if [ -z "$DOCKERD_CONF" ]; then
+ if [ -z "${DOCKERD_CONF}" ]; then
procd_set_param command /usr/bin/dockerd
else
- procd_set_param command /usr/bin/dockerd --config-file="$DOCKERD_CONF"
+ procd_set_param command /usr/bin/dockerd --config-file="${DOCKERD_CONF}"
fi
procd_set_param limits nofile="${nofile} ${nofile}"
procd_close_instance