diff --git a/Dockerfile b/Dockerfile index 65a3db6..e675a11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ] diff --git a/Dockerfile.3.14 b/Dockerfile.3.14 index 7d64505..49e79eb 100644 --- a/Dockerfile.3.14 +++ b/Dockerfile.3.14 @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ] diff --git a/Dockerfile.3.15 b/Dockerfile.3.15 index 2ead424..11154ed 100644 --- a/Dockerfile.3.15 +++ b/Dockerfile.3.15 @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ] diff --git a/Dockerfile.3.16 b/Dockerfile.3.16 index 1d36d45..e7e0183 100644 --- a/Dockerfile.3.16 +++ b/Dockerfile.3.16 @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ] diff --git a/Dockerfile.3.17 b/Dockerfile.3.17 index a3c37bc..2028c04 100644 --- a/Dockerfile.3.17 +++ b/Dockerfile.3.17 @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ] diff --git a/Dockerfile.3.18 b/Dockerfile.3.18 index 7e94ce7..51a37df 100644 --- a/Dockerfile.3.18 +++ b/Dockerfile.3.18 @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ] diff --git a/Dockerfile.3.19 b/Dockerfile.3.19 index 84bd1c1..9a7aa7c 100644 --- a/Dockerfile.3.19 +++ b/Dockerfile.3.19 @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ] diff --git a/Dockerfile.3.20 b/Dockerfile.3.20 index 387a53b..61bd665 100644 --- a/Dockerfile.3.20 +++ b/Dockerfile.3.20 @@ -70,9 +70,11 @@ WORKDIR /root RUN set -e; \ echo "Setting up prerequisites"; \ apk --no-cache add bash; \ - BASH_CMD="$(command -v bash 2>/dev/null|| true)"; \ - [ -x "$BASH_CMD" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true; \ - [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true + SH_CMD="$(which sh 2>/dev/null)"; \ + BASH_CMD="$(which bash 2>/dev/null)"; \ + [ -n "$BASH_CMD" ] && sed -i 's|root:x:.*|root:x:0:0:root:/root:'$BASH_CMD'|g' "/etc/passwd" || true; \ + [ -x "$BASH_CMD" ] && [ "$SH_CMD" != "/bin/sh" ] && { rm -Rf "$SH_CMD";ln -s "$BASH_CMD" "$SH_CMD"; } || true; \ + [ -x "$BASH_CMD" ] && [ ! -L "/bin/sh" ] && { rm -rf "/bin/sh" || true; } && ln -sf "$BASH_CMD" "/bin/sh" || true ENV SHELL="/bin/bash" SHELL [ "/bin/bash", "-c" ]