-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d7c501
commit e295e94
Showing
7 changed files
with
121 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
FROM alpine:3.13.1 | ||
FROM ubuntu:18.04 | ||
LABEL maintainer "Jan Delgado <[email protected]>" | ||
|
||
RUN apk add --update asciidoc bash bc binutils bzip2 cdrkit coreutils\ | ||
diffutils findutils flex g++ gawk gcc gettext git grep\ | ||
intltool libxslt linux-headers make ncurses-dev patch\ | ||
perl python2-dev tar unzip util-linux wget zlib-dev xz\ | ||
python3 rsync\ | ||
su-exec\ | ||
&& rm -rf /var/cache/apk/* | ||
RUN apt-get update\ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential\ | ||
libncurses5-dev libncursesw5-dev zlib1g-dev gawk git gettext libssl-dev\ | ||
xsltproc rsync wget unzip python3\ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ADD etc/entrypoint.sh /usr/local/bin/ | ||
RUN chmod 755 /usr/local/bin/entrypoint.sh | ||
|
@@ -19,8 +17,7 @@ ADD $BUILDER_URL /tmp/imagebuilder | |
|
||
RUN mkdir -p /lede/imagebuilder\ | ||
&& tar xf /tmp/imagebuilder --strip-components=1 -C /lede/imagebuilder\ | ||
&& rm -f /tmp/imagebuilder | ||
|
||
&& rm -f /tmp/imagebuilder | ||
|
||
WORKDIR "/lede/imagebuilder" | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# only needed in docker, not rootless podman. | ||
if [ -f /.dockerenv ]; then | ||
# this is very, very slow inside a docker container. | ||
chown -R "$GOSU_UID:$GOSU_GID" /lede | ||
fi | ||
|
||
# If GOSU_UID:GOSU_GID environment variable set to something other than 0:0 (root:root), | ||
# become user:group set within and exec command passed in args | ||
if [ "$GOSU_UID:$GOSU_GID" != "0:0" ]; then | ||
# make sure a valid user exists in /etc/passwd | ||
sed -i "/^builder:/d" /etc/passwd || true | ||
echo "builder:x:$GOSU_UID:$GOSU_GID:LEDE builder:/lede:/bin/bash" >> /etc/passwd | ||
sed -i "/^builder:/d" /etc/group || true | ||
echo "builder:x:$GOSU_GID" >> /etc/group | ||
exec su-exec "$GOSU_UID:$GOSU_GID" "$@" | ||
if [ "$GOSU_UID:$GOSU_GID" != "0:0" ] && [ "$GOSU_UID:$GOSU_GID" != ":" ]; then | ||
export HOME="/lede" | ||
|
||
|
||
|
||
groupadd -f -g "$GOSU_GID" builder | ||
useradd -u "$GOSU_UID" -g "$GOSU_GID" -s /bin/bash -d "/lede" builder || : | ||
|
||
# make sure user has write permissions | ||
su builder -c "touch /lede/.writetest > /dev/null 2>&1" || ( echo "fix permissions..."; chown -R "$GOSU_UID:$GOSU_GID" /lede/imagebuilder ) | ||
exec chroot --userspec "$GOSU_UID:$GOSU_GID" --skip-chdir / "$@" | ||
fi | ||
|
||
# If GOSU_UID:GOSU_GID was 0:0 exec command passed in args without gosu (assume already root) | ||
# If GOSU_UID:GOSU_GID was 0:0 exec command passed in args | ||
# without gosu (assume already root) | ||
exec "$@" | ||
|