File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,9 +27,11 @@ SHELL ["sh", "-c"]
2727# so this odd-looking script forces the update process
2828# to work using the -s argument of toybox-su instead, which is working.
2929RUN sh -T /dev/ptmx -c "$TERMUX__PREFIX/bin/dnsmasq -u root -g root --pid-file=/dnsmasq.pid" && \
30- sleep 1 && \
3130 echo '#!/system/bin/sh' > /update.sh && \
3231 echo "PATH=$TERMUX__PREFIX/bin" >> /update.sh && \
32+ echo 'while [ ! -f /dnsmasq.pid ]; do' >> /update.sh && \
33+ echo 'sleep 1' >> /update.sh && \
34+ echo 'done' >> /update.sh && \
3335 echo "source $TERMUX__PREFIX/bin/termux-setup-package-manager" >> /update.sh && \
3436 echo 'if [ "$TERMUX_APP_PACKAGE_MANAGER" = "apt" ]; then' >> /update.sh && \
3537 echo 'apt update' >> /update.sh && \
@@ -65,7 +67,7 @@ ENV TMPDIR=${TERMUX__PREFIX}/tmp
6567ENV TZ=UTC
6668ENV TERM=xterm
6769
68- COPY --from=bootstrap / /
70+ COPY --from=bootstrap --exclude=dnsmasq.pid / /
6971
7072WORKDIR ${TERMUX__HOME}
7173SHELL ["sh" , "-c" ]
Original file line number Diff line number Diff line change @@ -10,13 +10,14 @@ if [ "$(id -u)" != "0" ]; then
1010fi
1111
1212if [ -z " $( pidof dnsmasq) " ]; then
13+ rm -f /dnsmasq.pid
1314 /system/bin/sh -T /dev/ptmx -c " dnsmasq -u root -g root --pid-file=/dnsmasq.pid" > /dev/null 2>&1
14- sleep 1
15- if [ -z " $( pidof dnsmasq) " ]; then
16- echo " [!] Failed to start dnsmasq, host name resolution may fail." >&2
17- fi
1815fi
1916
17+ while [ ! -f /dnsmasq.pid ]; do
18+ sleep 1
19+ done
20+
2021exec /system/bin/su -s " $PREFIX /bin/env" system -- \
2122 -i \
2223 ANDROID_DATA=" $ANDROID_DATA " \
Original file line number Diff line number Diff line change @@ -10,11 +10,12 @@ if [ "$(id -u)" != "0" ]; then
1010fi
1111
1212if [ -z " $( pidof dnsmasq) " ]; then
13+ rm -f /dnsmasq.pid
1314 /system/bin/sh -T /dev/ptmx -c " dnsmasq -u root -g root --pid-file=/dnsmasq.pid" > /dev/null 2>&1
14- sleep 1
15- if [ -z " $( pidof dnsmasq) " ]; then
16- echo " [!] Failed to start dnsmasq, host name resolution may fail." >&2
17- fi
1815fi
1916
17+ while [ ! -f /dnsmasq.pid ]; do
18+ sleep 1
19+ done
20+
2021exec " $@ "
You can’t perform that action at this time.
0 commit comments