mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/docker-easyconnect/docker-easyconnect.git
synced 2026-09-20 08:03:33 +08:00
On docker, `/proc/self/loginuid` is -1 by default, while on podman it is 0 (root), which makes aTrust services refuse to start, because after they use `getlogin_r`, which is affected by `/proc/self/loginuid`, to get the username successfully, they give up trying any other way (such as `loginctl`) to get the non-root user used to start the http server (port 54631), even if the username they got is root. This commit adds a LD_PRELOAD hook named fake-getlogin, which hooks `getlogin` and `getlogin_r` to provide the non-root username directly. This commit also: - reduces errors when running postinst script of aTrust; - uses LD_LIBRARY_PATH to make aTrust use its versions of libraries, especially those very old and no longer getatable from debian packages.
53 lines
3.1 KiB
Docker
53 lines
3.1 KiB
Docker
FROM debian:bookworm-slim AS build
|
|
|
|
ARG ANDROID_PATCH BUILD_ENV=local MIRROR_URL=http://ftp.cn.debian.org/debian/ EC_HOST
|
|
|
|
COPY ["./build-scripts/config-apt.sh", "./build-scripts/get-echost-names.sh", "/tmp/build-scripts/"]
|
|
|
|
RUN . /tmp/build-scripts/config-apt.sh && \
|
|
. /tmp/build-scripts/get-echost-names.sh && \
|
|
case "$(dpkg --print-architecture)" in \
|
|
amd64 | i386 | arm64 ) go=golang-go ;; \
|
|
* ) go=gccgo-go ;; \
|
|
esac && \
|
|
apt-get update && \
|
|
apt-get install -y --no-install-recommends --no-install-suggests ca-certificates \
|
|
busybox libssl-dev automake $go $ecgccpkg build-essential
|
|
|
|
RUN mkdir results && cd results && mkdir fake-hwaddr tinyproxy-ws novnc fake-getlogin && mkdir /tmp/src -p
|
|
|
|
COPY fake-hwaddr /tmp/src/fake-hwaddr/
|
|
COPY fake-getlogin /tmp/src/fake-getlogin/
|
|
|
|
RUN . /tmp/build-scripts/get-echost-names.sh && \
|
|
cd /tmp/src/fake-hwaddr && CC=${ec_cc} make clean all && install -D fake-hwaddr.so /results/fake-hwaddr/usr/local/lib/fake-hwaddr.so && \
|
|
cd /tmp/src/fake-getlogin && CC=${ec_cc} make clean all && install -D fake-getlogin.so /results/fake-getlogin/usr/local/lib/fake-getlogin.so
|
|
|
|
# https://github.com/tinyproxy/tinyproxy/pull/211#issue-382736027
|
|
ARG TINYPROXY_COMMIT=991e47d8ebd4b12710828b2b486535e4c25ba26c
|
|
|
|
RUN cd /tmp/src/ && \
|
|
busybox wget https://github.com/tinyproxy/tinyproxy/archive/${TINYPROXY_COMMIT}.zip -O tinyproxy.zip && \
|
|
busybox unzip tinyproxy.zip && mv tinyproxy-${TINYPROXY_COMMIT} tinyproxy && cd tinyproxy && \
|
|
./autogen.sh --prefix=/usr && make && install -D src/tinyproxy /results/tinyproxy-ws/usr/bin/tinyproxy
|
|
|
|
ARG NOVNC_METHOD=min-size GOPROXY=http://proxy.golang.com.cn,direct
|
|
|
|
RUN cd /tmp/src/ && \
|
|
case "${NOVNC_METHOD}" in \
|
|
min-size ) \
|
|
busybox wget https://github.com/novnc/noVNC/archive/refs/heads/master.zip -O novnc.zip && \
|
|
busybox wget https://github.com/novnc/websockify-other/archive/refs/heads/master.zip -O novnc-websockify.zip && \
|
|
busybox unzip novnc.zip && mv noVNC-master novnc && ln -s vnc.html novnc/index.html && \
|
|
sed -i "s#UI.initSetting('path', 'websockify')#UI.initSetting('path','websockify/websockify')#" novnc/app/ui.js && \
|
|
mkdir -p /results/novnc/usr/local/share/ && mv novnc /results/novnc/usr/local/share/novnc && \
|
|
busybox unzip novnc-websockify.zip && mv websockify-other-master novnc-websockify && \
|
|
cd novnc-websockify/c/ && make && install -D websockify /results/novnc/usr/local/bin/websockify ;; \
|
|
easy-novnc ) \
|
|
busybox wget https://github.com/pgaskin/easy-novnc/archive/refs/heads/master.zip -O easy-novnc.zip && \
|
|
busybox unzip easy-novnc.zip && mv easy-novnc-master easy-novnc && cd easy-novnc && \
|
|
go build -ldflags "-s -w" -gccgoflags "-Wl,-s,-gc-sections -fdata-sections -ffunction-sections -static-libgo" && \
|
|
install -D easy-novnc /results/novnc/usr/local/bin/easy-novnc ;; \
|
|
* ) printf "Not a vaild value of NOVNC_METHOD: %s\n" "${NOVNC_METHOD}" >&2 && false ;; \
|
|
esac && ln -s novnc-${NOVNC_METHOD}.sh /results/novnc/usr/local/bin/novnc
|