Skip to content

Commit f234f54

Browse files
lun-4the-maldridge
authored andcommitted
dockerfiles: use switch case for repo variables
1 parent ff2511d commit f234f54

7 files changed

Lines changed: 56 additions & 49 deletions

Dockerfile.bootstrap

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ RUN apk add ca-certificates curl && \
77
curl ${REPOSITORY}/static/xbps-static-static-0.59_5.$(uname -m)-musl.tar.xz | \
88
tar vJx && \
99
rm -f /etc/ssl/certs/2e5ac55d.* && \
10-
if [ "${ARCH%-musl}" = "aarch64" ]; then \
11-
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64"; \
12-
elif [[ "${ARCH}" = "*-musl" ]]; then \
13-
export REPOSITORIES="--repository=${REPOSITORY}/current/musl"; \
14-
else \
15-
export REPOSITORIES="--repository=${REPOSITORY}/current"; \
16-
fi; \
10+
case "${ARCH}" in \
11+
aarch64*) \
12+
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64" ;; \
13+
*-musl) \
14+
export REPOSITORIES="--repository=${REPOSITORY}/current/musl" ;; \
15+
*) \
16+
export REPOSITORIES="--repository=${REPOSITORY}/current" ;; \
17+
esac; \
1718
XBPS_ARCH=${ARCH} xbps-install.static -yMU \
1819
$REPOSITORIES \
1920
-r /target \

Dockerfile.full

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ COPY keys/* /target/var/db/xbps/keys/
55
ARG REPOSITORY=https://repo-us.voidlinux.org
66
ARG ARCH=x86_64
77
RUN \
8-
if [ "${ARCH%-musl}" = "aarch64" ]; then \
9-
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64"; \
10-
elif [[ "${ARCH}" = "*-musl" ]]; then \
11-
export REPOSITORIES="--repository=${REPOSITORY}/current/musl"; \
12-
else \
13-
export REPOSITORIES="--repository=${REPOSITORY}/current"; \
14-
fi; \
8+
case "${ARCH}" in \
9+
aarch64*) \
10+
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64" ;; \
11+
*-musl) \
12+
export REPOSITORIES="--repository=${REPOSITORY}/current/musl" ;; \
13+
*) \
14+
export REPOSITORIES="--repository=${REPOSITORY}/current" ;; \
15+
esac; \
1516
XBPS_ARCH=${ARCH} xbps-install -yMUS \
1617
$REPOSITORIES \
1718
-r /target \

Dockerfile.masterdir

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ COPY keys/* /target/var/db/xbps/keys/
55
ARG REPOSITORY=https://repo-us.voidlinux.org
66
ARG ARCH=x86_64
77
RUN \
8-
if [ "${ARCH%-musl}" = "aarch64" ]; then \
9-
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64"; \
10-
elif [[ "${ARCH}" = "*-musl" ]]; then \
11-
export REPOSITORIES="--repository=${REPOSITORY}/current/musl"; \
12-
else \
13-
export REPOSITORIES="--repository=${REPOSITORY}/current"; \
14-
fi; \
8+
case "${ARCH}" in \
9+
aarch64*) \
10+
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64" ;; \
11+
*-musl) \
12+
export REPOSITORIES="--repository=${REPOSITORY}/current/musl" ;; \
13+
*) \
14+
export REPOSITORIES="--repository=${REPOSITORY}/current" ;; \
15+
esac; \
1516
XBPS_ARCH=${ARCH} xbps-install -yMUS \
1617
$REPOSITORIES \
1718
-r /target \

Dockerfile.mini

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ COPY noextract.conf /target/etc/xbps.d/noextract.conf
66
ARG REPOSITORY=https://repo-us.voidlinux.org
77
ARG ARCH=x86_64
88
RUN \
9-
if [ "${ARCH%-musl}" = "aarch64" ]; then \
10-
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64"; \
11-
elif [[ "${ARCH}" = "*-musl" ]]; then \
12-
export REPOSITORIES="--repository=${REPOSITORY}/current/musl"; \
13-
else \
14-
export REPOSITORIES="--repository=${REPOSITORY}/current"; \
15-
fi; \
9+
case "${ARCH}" in \
10+
aarch64*) \
11+
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64" ;; \
12+
*-musl) \
13+
export REPOSITORIES="--repository=${REPOSITORY}/current/musl" ;; \
14+
*) \
15+
export REPOSITORIES="--repository=${REPOSITORY}/current" ;; \
16+
esac; \
1617
XBPS_ARCH=${ARCH} xbps-install -yMU \
1718
$REPOSITORIES \
1819
-r /target \

Dockerfile.mini-bb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ COPY noextract.conf /target/etc/xbps.d/noextract.conf
66
ARG REPOSITORY=https://repo-us.voidlinux.org
77
ARG ARCH=x86_64
88
RUN \
9-
if [ "${ARCH%-musl}" = "aarch64" ]; then \
10-
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64"; \
11-
elif [[ "${ARCH}" = "*-musl" ]]; then \
12-
export REPOSITORIES="--repository=${REPOSITORY}/current/musl"; \
13-
else \
14-
export REPOSITORIES="--repository=${REPOSITORY}/current"; \
15-
fi; \
9+
case "${ARCH}" in \
10+
aarch64*) \
11+
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64" ;; \
12+
*-musl) \
13+
export REPOSITORIES="--repository=${REPOSITORY}/current/musl" ;; \
14+
*) \
15+
export REPOSITORIES="--repository=${REPOSITORY}/current" ;; \
16+
esac; \
1617
XBPS_ARCH=${ARCH} xbps-install -yMU \
1718
$REPOSITORIES \
1819
-r /target \

Dockerfile.thin

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ COPY noextract.conf /target/etc/xbps.d/noextract.conf
66
ARG REPOSITORY=https://repo-us.voidlinux.org
77
ARG ARCH=x86_64
88
RUN \
9-
if [ "${ARCH%-musl}" = "aarch64" ]; then \
10-
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64"; \
11-
elif [[ "${ARCH}" = "*-musl" ]]; then \
12-
export REPOSITORIES="--repository=${REPOSITORY}/current/musl"; \
13-
else \
14-
export REPOSITORIES="--repository=${REPOSITORY}/current"; \
15-
fi; \
9+
case "${ARCH}" in \
10+
aarch64*) \
11+
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64" ;; \
12+
*-musl) \
13+
export REPOSITORIES="--repository=${REPOSITORY}/current/musl" ;; \
14+
*) \
15+
export REPOSITORIES="--repository=${REPOSITORY}/current" ;; \
16+
esac; \
1617
XBPS_ARCH=${ARCH} xbps-install -yMU \
1718
$REPOSITORIES \
1819
-r /target \

Dockerfile.thin-bb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ COPY noextract.conf /target/etc/xbps.d/noextract.conf
66
ARG REPOSITORY=https://repo-us.voidlinux.org
77
ARG ARCH=x86_64
88
RUN \
9-
if [ "${ARCH%-musl}" = "aarch64" ]; then \
10-
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64"; \
11-
elif [[ "${ARCH}" = "*-musl" ]]; then \
12-
export REPOSITORIES="--repository=${REPOSITORY}/current/musl"; \
13-
else \
14-
export REPOSITORIES="--repository=${REPOSITORY}/current"; \
15-
fi; \
9+
case "${ARCH}" in \
10+
aarch64*) \
11+
export REPOSITORIES="--repository=${REPOSITORY}/current/aarch64" ;; \
12+
*-musl) \
13+
export REPOSITORIES="--repository=${REPOSITORY}/current/musl" ;; \
14+
*) \
15+
export REPOSITORIES="--repository=${REPOSITORY}/current" ;; \
16+
esac; \
1617
XBPS_ARCH=${ARCH} xbps-install -yMU \
1718
$REPOSITORIES \
1819
-r /target \

0 commit comments

Comments
 (0)