main/postmarketos-mkinitfs: replace udhcpd with unudhcpd (MR 2698)

unudhcpd is a lightweight dhcp server that effectively implements static
assignment of a single IP on an interface regardless of client MAC, with
no lease. The end result is that a system connected to a pmOS device via
usb networking should always get an IP, and always get one very quickly.

This adds a new dependency on this dhcp server, and starts it in initfs.

Fixes #1199

[ci:skip-build] already built successfully in CI
This commit is contained in:
Clayton Craft 2021-10-03 20:41:45 -07:00
parent a878c81cbb
commit d1a6daca20
No known key found for this signature in database
GPG Key ID: 4A4CED6D7EDF950A
3 changed files with 14 additions and 25 deletions

View File

@ -1,8 +1,8 @@
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=postmarketos-mkinitfs
pkgver=1.1.2
pkgrel=4
pkgver=1.2
pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
depends="
@ -18,6 +18,7 @@ depends="
multipath-tools
parted
postmarketos-fde-unlocker
unudhcpd
xz
"
makedepends="go"
@ -66,8 +67,8 @@ check() {
}
sha512sums="
67341444c21fc884751ee12fec4069132184d6346fe6dee3f90989ed1417322336c3f135a5099dce5cecce64ad1f2a5e7ce254e5fdc772e20a150facb09f3763 postmarketos-mkinitfs-1.1.2.tar.gz
c78a82e4468ac5e662898337d2f094c2c8596bb3adf931e4731e07424bc04a5c7c72f450401187dca6992babba4794fe835f7e692758f35eaa5bec61856b671f postmarketos-mkinitfs-1.2.tar.gz
950ac042f19055979cb53b39be93866c88aba0acd5a49cd768522505991e2bd2851735677e777caa6c8973e006318582ddd975214eccc5c35c2c1d649af6d71e 00-default.modules
40033b421e79999c85bd72e1353fe6745a87fcbf9f6a5b8180e832c7f340da7d4e33d056f557ae95a9924f5d186a6e728f3ed53c0922cdac4c39513fdc3e3a82 init.sh
ac097c23ea8807aeac9af6ee1ced4fb41f2e108d9ebed61062decec02a2f0cece8bf1d5f45e5d52928ccead09f0b44190f6b1008018b6d845ba1b5d26679d82f init_functions.sh
0c6d2c749952ff027f1c435a7a3b2861fb632b81c16b6d69a92b47457da4af8cb80e50168b93f92b316377c8c1f5243029fca22ac49fef0940eb5ad6c3dff6ec init.sh
0f631fb08f44b3aaaf44649c164040a6effda2a921c4bfc6e1b55e265ce4395947a8620e669902d18e62f7eabae0e9ef2b88d2d985d6714d27db02eb8b412cc2 init_functions.sh
"

View File

@ -32,7 +32,7 @@ done
# be enabled, when having the debug-shell hook installed for debugging,
# or get activated after the initramfs is done with an OpenRC service).
setup_usb_network
start_udhcpd
start_unudhcpd
mount_boot_partition /boot
show_splash_loading

View File

@ -443,19 +443,18 @@ setup_usb_network() {
setup_usb_network_configfs
}
start_udhcpd() {
start_unudhcpd() {
# Only run once
[ -e /etc/udhcpd.conf ] && return
[ "$(pidof unudhcpd)" ] && return
# Skip if disabled
# shellcheck disable=SC2154
if [ "$deviceinfo_disable_dhcpd" = "true" ]; then
echo "NOTE: start of dhcpd is disabled (deviceinfo_disable_dhcpd)"
touch /etc/udhcpcd.conf
return
fi
echo "Starting udhcpd"
echo "Starting unudhcpd"
# Get usb interface
INTERFACE=""
ifconfig rndis0 "$IP" 2>/dev/null && INTERFACE=rndis0
@ -474,21 +473,10 @@ start_udhcpd() {
fi
echo " Using interface $INTERFACE"
# Create /etc/udhcpd.conf
{
echo "start 172.16.42.2"
echo "end 172.16.42.2"
echo "auto_time 0"
echo "decline_time 0"
echo "conflict_time 0"
echo "lease_file /var/udhcpd.leases"
echo "interface $INTERFACE"
echo "option subnet 255.255.255.0"
} >/etc/udhcpd.conf
echo " Start the dhcpcd daemon (forks into background)"
udhcpd
echo " Starting the DHCP daemon"
(
unudhcpd -i "$INTERFACE" -s 172.16.42.1 -c 172.16.42.2
) &
}
# $1: SDL_VIDEODRIVER value (e.g. 'kmsdrm', 'directfb')