From e7633ba62583438640cdaa216c0f8f00bc37ad91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=81LI=20G=C3=A1bor=20J=C3=A1nos?= Date: Sun, 24 Sep 2023 10:01:50 +0200 Subject: dhcpcd: import with support for udhcpd daisy-chaining --- aports/dhcpcd/99-udhcpd.conf | 20 ++++++++++++++ aports/dhcpcd/APKBUILD | 54 ++++++++++++++++++++++++++++++++++++++ aports/dhcpcd/busybox-logger.patch | 13 +++++++++ aports/dhcpcd/dhcpcd.initd | 20 ++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 aports/dhcpcd/99-udhcpd.conf create mode 100644 aports/dhcpcd/APKBUILD create mode 100644 aports/dhcpcd/busybox-logger.patch create mode 100644 aports/dhcpcd/dhcpcd.initd diff --git a/aports/dhcpcd/99-udhcpd.conf b/aports/dhcpcd/99-udhcpd.conf new file mode 100644 index 0000000..2801fd0 --- /dev/null +++ b/aports/dhcpcd/99-udhcpd.conf @@ -0,0 +1,20 @@ +# Update domain name server IPv4 addresses and +# restart udhcpd on reconfiguration of the interface. + +RESOLV_CONF="/etc/resolv.conf" +UDHCPD_CONF="/tmp/udhcpd.conf" +UDHCPD_CONF_TEMPLATE="/etc/udhcpd.conf" + +if $if_configured; then + [ ! -f "$RESOLV_CONF" ] && return + + # Filter resolv.conf to get the IPv4 name servers + # only. + dns=$(grep -F nameserver $RESOLV_CONF | cut -c 12- | grep -E "^[0-9\.]*$") + + cat $UDHCPD_CONF_TEMPLATE \ + | sed "s!%%DNS%%!$dns!" \ + > $UDHCPD_CONF + chmod a+r "$UDHCPD_CONF" + service udhcpd --ifstarted restart +fi diff --git a/aports/dhcpcd/APKBUILD b/aports/dhcpcd/APKBUILD new file mode 100644 index 0000000..badc610 --- /dev/null +++ b/aports/dhcpcd/APKBUILD @@ -0,0 +1,54 @@ +# Maintainer: Gabor Pali +pkgname=dhcpcd +pkgver=10.0.2 +pkgrel=0 # base: 1 +pkgdesc="RFC2131 compliant DHCP client" +url="https://roy.marples.name/projects/dhcpcd" +arch="all" +license="BSD-2-Clause" +makedepends="linux-headers bsd-compat-headers" +install= +source="$pkgname-$pkgver.tar.gz::https://github.com/NetworkConfiguration/dhcpcd/archive/refs/tags/v$pkgver.tar.gz + $pkgname-seccomp-toggle-1.patch::https://github.com/NetworkConfiguration/dhcpcd/commit/8b65e2d6c7da1688df00753f872d8805631e07cb.diff + $pkgname-seccomp-toggle-2.patch::https://github.com/NetworkConfiguration/dhcpcd/commit/43c4b1b57264b7b2d565a517b32b6e80c06c89e0.diff + busybox-logger.patch + dhcpcd.initd + 99-udhcpd.conf + " + +build() { + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --libexecdir=/usr/lib/$pkgname \ + --dbdir=/var/lib/$pkgname \ + --rundir=/run/dhcpcd \ + --runstatedir=/run/dhcpcd \ + --disable-seccomp \ + --enable-ipv6 \ + --enable-privsep \ + --without-dev \ + --without-udev + make +} + +package() { + make DESTDIR="$pkgdir" proginstall + install -Dm755 "$srcdir"/dhcpcd.initd \ + "$pkgdir"/etc/init.d/dhcpcd + install -Dm555 "$srcdir"/99-udhcpd.conf \ + "$pkgdir"/usr/lib/dhcpcd/dhcpcd-hooks/99-udhcpd.conf + ln -s /media/etc/dhcpcd.conf "$pkgdir"/etc +} + +sha512sums=" +eaf557a27f2223705cbfedf142ef45289eeb55056ceb9a90b760408db32c7e639e8f7c07a1ef5ec6f66ffc53971f5302f200ca522a6cd0ab76c4b0d70a3c2a59 dhcpcd-10.0.2.tar.gz +bb0d703b4a5142a218e17d320a56537de5f787b119564724fe0c9d5ee5ff84b7e2711b6f1c8e20f338cfbdcfec22f94971db187ce0af5876b9f4322ec94bb8b9 dhcpcd-seccomp-toggle-1.patch +6ffc69820142f70e9e8290c69c533970b0ac5a58a7deef75e8ca8da1f2ee7d52418af2962356c58ae5e4e34541e8ceb2f2fe2af81302fb31164209d4223c18da dhcpcd-seccomp-toggle-2.patch +b6bdaac9fc0d5d2d7e8c5e30d1a45db1cff2284d01f92f8821b2f03aaff4e0dbd8cbfbced96d8d9d934dc11f22b792a8345d634d8e4e3b84f43016b7e866e302 busybox-logger.patch +7fb44b82a6fa25ee6249fc4835853a4c1fc7d327653efabd9fde303b1f306b3aa6956b2621b55a24fc007ec7ad878ce50e7418ebff0b17fece76e2fdd9e5190d dhcpcd.initd +c3d551505e22e253bed29fda5c4766ab8b23f14883df0c342b04c835f7ed50d90714a053c86b281bb9924fd9a83cdc6015ecc51217852f0ab2c63058b5d625a5 99-udhcpd.conf +" diff --git a/aports/dhcpcd/busybox-logger.patch b/aports/dhcpcd/busybox-logger.patch new file mode 100644 index 0000000..220b914 --- /dev/null +++ b/aports/dhcpcd/busybox-logger.patch @@ -0,0 +1,13 @@ +diff --git a/hooks/dhcpcd-run-hooks.in b/hooks/dhcpcd-run-hooks.in +index 91df64b..c6fb8c6 100644 +--- a/hooks/dhcpcd-run-hooks.in ++++ b/hooks/dhcpcd-run-hooks.in +@@ -179,7 +179,7 @@ syslog() + *) echo "$interface: $*";; + esac + if command -v logger >/dev/null 2>&1; then +- logger -i -p daemon."$lvl" -t dhcpcd-run-hooks "$interface: $*" ++ logger -p daemon."$lvl" -t dhcpcd-run-hooks "$interface: $*" + fi + } + diff --git a/aports/dhcpcd/dhcpcd.initd b/aports/dhcpcd/dhcpcd.initd new file mode 100644 index 0000000..bcefb60 --- /dev/null +++ b/aports/dhcpcd/dhcpcd.initd @@ -0,0 +1,20 @@ +#!/sbin/openrc-run + +description="DHCP Client Daemon" + +command="/sbin/dhcpcd" +command_args="-q -B ${command_args:-}" +command_background="true" +pidfile="/run/dhcpcd/pid" + +depend() { + provide net + need localmount + use logger network + after bootmisc modules + before dns +} + +start_pre() { + checkpath -d /run/dhcpcd +} -- cgit v1.2.3