Browse Source

docker-ce: Made some shellcheck recommendations

Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
lilik-openwrt-22.03
Gerard Ryan 4 years ago
parent
commit
eb55c8b51a
1 changed files with 18 additions and 18 deletions
  1. +18
    -18
      utils/docker-ce/files/dockerd.init

+ 18
- 18
utils/docker-ce/files/dockerd.init View File

@ -9,11 +9,11 @@ extra_command "ucidel" "Delete default bridge configuration from network and fir
DOCKERD_CONF="/tmp/dockerd/daemon.json" DOCKERD_CONF="/tmp/dockerd/daemon.json"
uci_quiet() { uci_quiet() {
uci -q ${@} >/dev/null
uci -q "${@}" >/dev/null
} }
json_add_array_string() { json_add_array_string() {
json_add_string "" "$1"
json_add_string "" "${1}"
} }
boot() { boot() {
@ -22,14 +22,14 @@ boot() {
} }
uciupdate() { uciupdate() {
local net="$1"
local net="${1}"
uci -q get network.docker >/dev/null || { uci -q get network.docker >/dev/null || {
logger -t "dockerd-init" -p warn "No network uci config section for docker default bridge (docker0) found" logger -t "dockerd-init" -p warn "No network uci config section for docker default bridge (docker0) found"
return return
} }
[ -z "$net" ] && {
[ -z "${net}" ] && {
logger -t "dockerd-init" -p notice "Removing network uci config options for docker default bridge (docker0)" 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.netmask
uci_quiet delete network.docker.ipaddr uci_quiet delete network.docker.ipaddr
@ -37,10 +37,10 @@ uciupdate() {
return 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 uci_quiet commit network
} }
@ -112,7 +112,7 @@ ucidel() {
process_config() { process_config() {
local alt_config_file data_root log_level bip local alt_config_file data_root log_level bip
rm -f "$DOCKERD_CONF"
rm -f "${DOCKERD_CONF}"
[ -f /etc/config/dockerd ] || { [ -f /etc/config/dockerd ] || {
# Use the daemon default configuration # Use the daemon default configuration
@ -123,8 +123,8 @@ process_config() {
config_load 'dockerd' config_load 'dockerd'
config_get alt_config_file globals alt_config_file 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 return 0
} }
@ -134,9 +134,9 @@ process_config() {
. /usr/share/libubox/jshn.sh . /usr/share/libubox/jshn.sh
json_init 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" json_add_array "registry-mirrors"
config_list_foreach globals registry_mirrors json_add_array_string config_list_foreach globals registry_mirrors json_add_array_string
json_close_array json_close_array
@ -145,9 +145,9 @@ process_config() {
json_close_array json_close_array
mkdir -p /tmp/dockerd mkdir -p /tmp/dockerd
json_dump > "$DOCKERD_CONF"
json_dump > "${DOCKERD_CONF}"
uciupdate "$bip"
uciupdate "${bip}"
} }
start_service() { start_service() {
@ -157,10 +157,10 @@ start_service() {
procd_open_instance procd_open_instance
procd_set_param stderr 1 procd_set_param stderr 1
if [ -z "$DOCKERD_CONF" ]; then
if [ -z "${DOCKERD_CONF}" ]; then
procd_set_param command /usr/bin/dockerd procd_set_param command /usr/bin/dockerd
else else
procd_set_param command /usr/bin/dockerd --config-file="$DOCKERD_CONF"
procd_set_param command /usr/bin/dockerd --config-file="${DOCKERD_CONF}"
fi fi
procd_set_param limits nofile="${nofile} ${nofile}" procd_set_param limits nofile="${nofile} ${nofile}"
procd_close_instance procd_close_instance


Loading…
Cancel
Save