bin: delete update-static-dns script

This commit is contained in:
Leonid Pliushch
2023-02-22 21:49:13 +02:00
parent ddbe3b603e
commit 5e5f33f672
5 changed files with 9 additions and 162 deletions

View File

@@ -13,10 +13,6 @@ ENV PATH /system/bin
# Copy libc, linker and few utilities.
COPY /system/$SYSTEM_TYPE /system
# Static DNS hosts: as our system does not have a DNS resolver, we will
# have to resolve domains manually and fill /system/etc/hosts.
COPY /static-dns-hosts.txt /system/etc/static-dns-hosts.txt
# Extract bootstrap archive and create symlinks.
ADD https://github.com/termux/termux-packages/releases/download/bootstrap-$BOOTSTRAP_VERSION/bootstrap-$BOOTSTRAP_ARCH.zip /bootstrap.zip
RUN busybox mkdir -p /data/data/com.termux/files && \
@@ -48,7 +44,6 @@ RUN for tool in df mount ping ping6 top umount; do \
# * Rest is owned by root and has 755/644 modes.
RUN busybox chown -Rh 0:0 /system && \
busybox chown -Rh 1000:1000 /data/data/com.termux && \
busybox chown 1000:1000 /system/etc/hosts /system/etc/static-dns-hosts.txt && \
busybox find /system -type d -exec busybox chmod 755 "{}" \; && \
busybox find /system -type f -executable -exec busybox chmod 755 "{}" \; && \
busybox find /system -type f ! -executable -exec busybox chmod 644 "{}" \; && \
@@ -58,29 +53,17 @@ RUN busybox chown -Rh 0:0 /system && \
busybox find ./bin ./lib/apt ./libexec -type f -exec busybox chmod 700 "{}" \;
# Switch user to non-root.
USER 1000:1000
# Update static DNS cache on login. Also symlink script and host list to prefix.
RUN echo "echo -e 'Updating static DNS:\n' && /system/bin/update-static-dns && echo" \
> /data/data/com.termux/files/home/.bashrc && \
busybox ln -s /system/bin/update-static-dns /data/data/com.termux/files/usr/bin/update-static-dns && \
busybox ln -s /system/etc/static-dns-hosts.txt /data/data/com.termux/files/usr/etc/static-dns-hosts.txt
# Create empty user static DNS cache (external bind)
RUN busybox mkdir -p /data/data/com.termux/files/home/.termux/termux-docker/ && \
busybox touch /data/data/com.termux/files/home/.termux/termux-docker/static-dns-hosts.txt && \
busybox chown 1000:1000 /data/data/com.termux/files/home/.termux/termux-docker/static-dns-hosts.txt
#USER 1000:1000
# Update static DNS cache, install updates and cleanup when not building for arm.
ENV PATH /data/data/com.termux/files/usr/bin
RUN if [ ${BOOTSTRAP_ARCH} == 'arm' ]; then exit; else \
update-static-dns && \
apt update && \
apt upgrade -o Dpkg::Options::=--force-confnew -yq && \
rm -rf /data/data/com.termux/files/usr/var/lib/apt/* && \
rm -rf /data/data/com.termux/files/usr/var/log/apt/* && \
rm -rf /data/data/com.termux/cache/apt/* ;\
fi
#ENV PATH /data/data/com.termux/files/usr/bin
#RUN if [ ${BOOTSTRAP_ARCH} == 'arm' ]; then exit; else \
# apt update && \
# apt upgrade -o Dpkg::Options::=--force-confnew -yq && \
# rm -rf /data/data/com.termux/files/usr/var/lib/apt/* && \
# rm -rf /data/data/com.termux/files/usr/var/log/apt/* && \
# rm -rf /data/data/com.termux/cache/apt/* ;\
# fi
##############################################################################
# Create final image.

View File

@@ -42,12 +42,6 @@ There a number of known issues which may not be resolved:
* ARM containers may require a custom seccomp profile to remove restrictions from
`personality()` system call.
* DNS: Docker image has to use a static DNS resolver through `/system/etc/hosts`.
You can regenerate this file by editing `/system/etc/static-dns-hosts.txt` or
`/data/data/com.termux/files/home/.termux/termux-docker/static-dns-hosts.txt` (aka
`~/.termux/termux-docker/static-dns-hosts.txt`) (this is preferable for docker binds)
and executing script `/system/bin/update-static-dns`.
* When running certain multi threaded program in 32bit containers, the PIDs can
balloon and easily exceed libc's limit. The only way to fix this is to set
`/proc/sys/kernel/pid_max` to 65536. See [termux-docker#40](https://github.com/termux/termux-docker/issues/40).

View File

@@ -1,60 +0,0 @@
##
## Termux Docker environment doesn't have working DNS resolver.
## This list contains domains that will be manually resolved. Result
## will be used to fill /system/etc/hosts.
##
# Termux repositories:
termux.net
termux.org
packages.termux.org
packages-cf.termux.org
packages.termux.dev
packages-cf.termux.dev
# Termux mirrors:
deb.kcubeterm.me
dl.kcubeterm.com
grimler.se
termux.mentality.rip
mirrors.bfsu.edu.cn
mirrors.tuna.tsinghua.edu.cn
mirrors.ustc.edu.cn
packages.kcubeterm.me
packages.kcubeterm.com
termux.astra.in.ua
mirror.bardia.tech
# Community repositories:
its-pointless.github.io
termux-pod.github.io
# Github:
github.com
objects.githubusercontent.com
codeload.github.com
gist.github.com
gist.githubusercontent.com
github-releases.githubusercontent.com
raw.githubusercontent.com
# Perl:
www.cpan.org
# Python package manager (pip):
pypi.org
test.pypi.org
upload.pypi.org
pythonhosted.org
files.pythonhosted.org
test-files.pythonhosted.org
# Ruby package manager (gem):
rubygems.org
index.rubygems.org
# Node package manager (npm):
registry.npmjs.org
# Yarn package manager (yarn):
registry.yarnpkg.com

View File

@@ -1,35 +0,0 @@
#!/system/bin/sh
export PATH=/system/bin
echo "127.0.0.1 localhost $(busybox hostname)" > /system/etc/hosts
echo "::1 ip6-localhost" >> /system/etc/hosts
# IPv4
for host in $(busybox cat /system/etc/static-dns-hosts.txt /data/data/com.termux/files/home/.termux/termux-docker/static-dns-hosts.txt | busybox grep -vE '^\s*#'); do
ip_addr=$(busybox nslookup -type=a "$host" 8.8.8.8 | busybox awk '/^Address: / { print $2 ; exit }')
if [ -z "$ip_addr" ]; then
echo "Can't resolve '$host'." >&2
continue
fi
echo "$ip_addr $host" | busybox tee -a /system/etc/hosts
done
# Check whether IPv6 is available.
busybox wget http://[2606:4700:4700::1111] -O /dev/null -o /dev/null
if [[ $? != 0 ]]; then
exit
fi
# IPv6
for host in $(busybox cat /system/etc/static-dns-hosts.txt /data/data/com.termux/files/home/.termux/termux-docker/static-dns-hosts.txt | busybox grep -vE '^\s*#'); do
ip_addr=$(busybox nslookup -type=aaaa "$host" 2001:4860:4860::8888 | busybox awk '/^Address: / { print $2 ; exit }')
if [ -z "$ip_addr" ]; then
echo "Can't resolve '$host'." >&2
continue
fi
echo "$ip_addr $host" | busybox tee -a /system/etc/hosts
done

View File

@@ -1,35 +0,0 @@
#!/system/bin/sh
export PATH=/system/bin
echo "127.0.0.1 localhost $(busybox hostname)" > /system/etc/hosts
echo "::1 ip6-localhost" >> /system/etc/hosts
# IPv4
for host in $(busybox cat /system/etc/static-dns-hosts.txt /data/data/com.termux/files/home/.termux/termux-docker/static-dns-hosts.txt | busybox grep -vE '^\s*#'); do
ip_addr=$(busybox nslookup -type=a "$host" 8.8.8.8 | busybox awk '/^Address: / { print $2 ; exit }')
if [ -z "$ip_addr" ]; then
echo "Can't resolve '$host'." >&2
continue
fi
echo "$ip_addr $host" | busybox tee -a /system/etc/hosts
done
# Check whether IPv6 is available.
busybox wget http://[2606:4700:4700::1111] -O /dev/null -o /dev/null
if [[ $? != 0 ]]; then
exit
fi
# IPv6
for host in $(busybox cat /system/etc/static-dns-hosts.txt /data/data/com.termux/files/home/.termux/termux-docker/static-dns-hosts.txt | busybox grep -vE '^\s*#'); do
ip_addr=$(busybox nslookup -type=aaaa "$host" 2001:4860:4860::8888 | busybox awk '/^Address: / { print $2 ; exit }')
if [ -z "$ip_addr" ]; then
echo "Can't resolve '$host'." >&2
continue
fi
echo "$ip_addr $host" | busybox tee -a /system/etc/hosts
done