Skip to content

Commit 11b071d

Browse files
committed
Add "devel" variant from Chet's "devel" branch
Chet updates a "devel" branch in https://git.savannah.gnu.org/cgit/bash.git roughly every seven days, which is a very reasonable cadence and worth publishing an image for.
1 parent 9282546 commit 11b071d

File tree

4 files changed

+117
-9
lines changed

4 files changed

+117
-9
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: bash
22
services: docker
33

44
env:
5+
- VERSION=devel
56
- VERSION=5.0
67
- VERSION=4.4
78
- VERSION=4.3

devel/Dockerfile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
FROM alpine:3.10
2+
3+
# https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel
4+
ENV _BASH_COMMIT ea578790a910fcd394930de7a1933a9ee24f9119
5+
# prefixed with "_" since "$BASH..." have meaning in Bash parlance
6+
7+
RUN set -eux; \
8+
\
9+
apk add --no-cache --virtual .build-deps \
10+
bison \
11+
coreutils \
12+
dpkg-dev dpkg \
13+
gcc \
14+
libc-dev \
15+
make \
16+
ncurses-dev \
17+
tar \
18+
; \
19+
\
20+
wget -O bash.tar.gz "https://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-$_BASH_COMMIT.tar.gz"; \
21+
\
22+
mkdir -p /usr/src/bash; \
23+
tar \
24+
--extract \
25+
--file=bash.tar.gz \
26+
--strip-components=1 \
27+
--directory=/usr/src/bash \
28+
; \
29+
rm bash.tar.gz; \
30+
\
31+
if [ -d bash-patches ]; then \
32+
for p in bash-patches/*; do \
33+
patch \
34+
--directory=/usr/src/bash \
35+
--input="$(readlink -f "$p")" \
36+
--strip=0 \
37+
; \
38+
rm "$p"; \
39+
done; \
40+
rmdir bash-patches; \
41+
fi; \
42+
\
43+
cd /usr/src/bash; \
44+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
45+
./configure \
46+
--build="$gnuArch" \
47+
--enable-readline \
48+
--with-curses \
49+
# musl does not implement brk/sbrk (they simply return -ENOMEM)
50+
# bash: xmalloc: locale.c:81: cannot allocate 18 bytes (0 bytes allocated)
51+
--without-bash-malloc \
52+
|| { \
53+
cat >&2 config.log; \
54+
false; \
55+
}; \
56+
make -j "$(nproc)"; \
57+
make install; \
58+
cd /; \
59+
rm -r /usr/src/bash; \
60+
\
61+
# delete a few installed bits for smaller image size
62+
rm -r \
63+
/usr/local/share/doc/bash/*.html \
64+
/usr/local/share/info \
65+
# /usr/local/share/locale \
66+
/usr/local/share/man \
67+
; \
68+
\
69+
runDeps="$( \
70+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
71+
| tr ',' '\n' \
72+
| sort -u \
73+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
74+
)"; \
75+
apk add --no-cache --virtual .bash-rundeps $runDeps; \
76+
apk del .build-deps; \
77+
\
78+
[ "$(which bash)" = '/usr/local/bin/bash' ]; \
79+
bash --version
80+
81+
COPY docker-entrypoint.sh /usr/local/bin/
82+
ENTRYPOINT ["docker-entrypoint.sh"]
83+
CMD ["bash"]

devel/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
# first arg is `-f` or `--some-option`
5+
# or there are no args
6+
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
7+
# docker run bash -c 'echo hi'
8+
exec bash "$@"
9+
fi
10+
11+
exec "$@"

update.sh

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ for version in "${versions[@]}"; do
2424
rcGrepV=
2525
fi
2626

27+
if [ "$version" = 'devel' ]; then
28+
commit="$(git ls-remote https://git.savannah.gnu.org/git/bash.git refs/heads/devel | cut -d$'\t' -f1)"
29+
if [ -z "$commit" ]; then
30+
echo >&2 "error: cannot determine commit for $version (from https://git.savannah.gnu.org/cgit/bash.git)"
31+
exit 1
32+
fi
33+
echo "$version: $commit"
34+
sed -ri -e 's/^(ENV _BASH_COMMIT) .*/\1 '"$commit"'/' "$version/Dockerfile"
35+
cp -a docker-entrypoint.sh "$version/"
36+
travisEnv='\n - VERSION='"$version$travisEnv"
37+
continue
38+
fi
39+
2740
bashVersion="$rcVersion"
2841

2942
IFS=$'\n'
@@ -62,15 +75,15 @@ for version in "${versions[@]}"; do
6275
bashVersion="$latestVersion" # "5.0-beta", "5.0-alpha", etc
6376
fi
6477

65-
(
66-
set -x
67-
sed -ri '
68-
s/^(ENV _BASH_VERSION) .*/\1 '"$bashVersion"'/;
69-
s/^(ENV _BASH_PATCH_LEVEL) .*/\1 '"$patchLevel"'/;
70-
s/^(ENV _BASH_LATEST_PATCH) .*/\1 '"$latestPatch"'/
71-
' "$version/Dockerfile"
72-
cp -a docker-entrypoint.sh "$version/"
73-
)
78+
echo "$version: $latestVersion"
79+
80+
sed -ri \
81+
-e 's/^(ENV _BASH_VERSION) .*/\1 '"$bashVersion"'/' \
82+
-e 's/^(ENV _BASH_PATCH_LEVEL) .*/\1 '"$patchLevel"'/' \
83+
-e 's/^(ENV _BASH_LATEST_PATCH) .*/\1 '"$latestPatch"'/' \
84+
"$version/Dockerfile"
85+
cp -a docker-entrypoint.sh "$version/"
86+
7487
travisEnv='\n - VERSION='"$version$travisEnv"
7588
done
7689

0 commit comments

Comments
 (0)