mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
17bdd56e02
It's been made redundant by the RPATH changes The only platform that gets the dubious honor of actually needing an LD_LIBRARY_PATH is PocketBook, because of InkView. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com> Bump base to pull in the aforementioned RPATH changes ;). https://github.com/koreader/koreader-base/pull/1638
36 lines
1.2 KiB
Bash
Executable File
36 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Release IP and shutdown udhcpc.
|
|
# NOTE: Save our resolv.conf to avoid ending up with an empty one, in case the DHCP client wipes it on release (#6424).
|
|
cp -a "/etc/resolv.conf" "/tmp/resolv.ko"
|
|
old_hash="$(md5sum "/etc/resolv.conf" | cut -f1 -d' ')"
|
|
|
|
if [ -x "/sbin/dhcpcd" ]; then
|
|
dhcpcd -d -k "${INTERFACE}"
|
|
killall -q -TERM udhcpc default.script
|
|
else
|
|
killall -q -TERM udhcpc default.script dhcpcd
|
|
ifconfig "${INTERFACE}" 0.0.0.0
|
|
fi
|
|
|
|
# NOTE: dhcpcd -k waits for the signalled process to die, but busybox's killall doesn't have a -w, --wait flag,
|
|
# so we have to wait for udhcpc to die ourselves...
|
|
# NOTE: But if all is well, there *isn't* any udhcpc process or script left to begin with...
|
|
kill_timeout=0
|
|
while pkill -0 udhcpc; do
|
|
# Stop waiting after 5s
|
|
if [ ${kill_timeout} -ge 20 ]; then
|
|
break
|
|
fi
|
|
usleep 250000
|
|
kill_timeout=$((kill_timeout + 1))
|
|
done
|
|
|
|
new_hash="$(md5sum "/etc/resolv.conf" | cut -f1 -d' ')"
|
|
# Restore our network-specific resolv.conf if the DHCP client wiped it when releasing the lease...
|
|
if [ "${new_hash}" != "${old_hash}" ]; then
|
|
mv -f "/tmp/resolv.ko" "/etc/resolv.conf"
|
|
else
|
|
rm -f "/tmp/resolv.ko"
|
|
fi
|