From 5b7b4d541766dcaa27db11fc82a5114790828deb Mon Sep 17 00:00:00 2001 From: Dan Theisen Date: Thu, 5 Jul 2018 22:52:23 -0700 Subject: user/dhcpcd: import, take, clean up --- user/dhcpcd/APKBUILD | 52 ++++++++++++++++++++++++++++++ user/dhcpcd/dhcpcd.initd | 14 ++++++++ user/dhcpcd/dhcpcd.post-upgrade | 24 ++++++++++++++ user/dhcpcd/fix-chrony-conf-location.patch | 11 +++++++ 4 files changed, 101 insertions(+) create mode 100644 user/dhcpcd/APKBUILD create mode 100644 user/dhcpcd/dhcpcd.initd create mode 100644 user/dhcpcd/dhcpcd.post-upgrade create mode 100644 user/dhcpcd/fix-chrony-conf-location.patch diff --git a/user/dhcpcd/APKBUILD b/user/dhcpcd/APKBUILD new file mode 100644 index 000000000..856088ea3 --- /dev/null +++ b/user/dhcpcd/APKBUILD @@ -0,0 +1,52 @@ +# Contributor: Michael Mason +# Contributor: Sören Tempel +# Contributor: Natanael Copa +# Maintainer: Dan Theisen +pkgname=dhcpcd +pkgver=7.0.6 +pkgrel=0 +pkgdesc="RFC2131 compliant DHCP client" +url="https://roy.marples.name/projects/dhcpcd" +arch="all" +license="BSD-2-Clause" +makedepends="linux-headers bsd-compat-headers eudev-dev" +install="$pkgname.post-upgrade" +subpackages="$pkgname-doc $pkgname-openrc" +source="https://roy.marples.name/downloads/dhcpcd/$pkgname-$pkgver.tar.xz + fix-chrony-conf-location.patch + dhcpcd.initd + " + +build() { + cd "$builddir" + + CFLAGS="$CFLAGS -D_GNU_SOURCE -DHAVE_PRINTF_M" + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --libexecdir=/usr/lib/$pkgname \ + --dbdir=/var/lib/$pkgname \ + --rundir=/run \ + --enable-ipv6 + make +} + +check() { + cd "$builddir" + make test +} + +package() { + cd "$builddir" + + make DESTDIR="$pkgdir" install + install -Dm755 "$srcdir"/dhcpcd.initd \ + "$pkgdir"/etc/init.d/dhcpcd +} + +sha512sums="5885739e60d6eb4fded117cb87f59a073ae6e8da8454dee56d8e7c5d33778e413e121d28a22163ebf31e4508a21d3a21c1d17ee6d4551081db2ee8e5384d44c9 dhcpcd-7.0.6.tar.xz +1c19eed0f7a008ee96ea392beb327169ff8c83fc27fed20f65f05c9125f60629ebe3474c5e6a7cf4aeeea448fde4264c9b84916efacd67d47ab908c47b1fc3a5 fix-chrony-conf-location.patch +e777432c2efc84285b41e63a4687f3bd543f6864218d037529ab78b5ad934de154f28f478bd9facb56628f2953aad8a932bc2eb8b1dfffa0ce2278ffcfc4d880 dhcpcd.initd" diff --git a/user/dhcpcd/dhcpcd.initd b/user/dhcpcd/dhcpcd.initd new file mode 100644 index 000000000..0539b25da --- /dev/null +++ b/user/dhcpcd/dhcpcd.initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run + +name="DHCP Client Daemon" +command="/sbin/dhcpcd" +pidfile="/run/dhcpcd.pid" +command_args="-q ${command_args:-}" + +depend() { + provide net + need localmount + use logger network + after bootmisc modules + before dns +} diff --git a/user/dhcpcd/dhcpcd.post-upgrade b/user/dhcpcd/dhcpcd.post-upgrade new file mode 100644 index 000000000..f1e7dc924 --- /dev/null +++ b/user/dhcpcd/dhcpcd.post-upgrade @@ -0,0 +1,24 @@ +#!/bin/sh + +ver_new="$1" +ver_old="$2" + +# Move dhcpcd.duid and dhcpcd.secret to new location when upgrading +# to dhcpcd 7.x. +# See https://roy.marples.name/blog/dhcpcd-7-finally-enters-beta. +if [ "$(apk version -t "$ver_old" '7.0.0-r0')" = '<' ]; then + dbdir='/var/lib/dhcpcd' + duid_old='/etc/dhcpcd.duid' + secret_old='/etc/dhcpcd.secret' + + if [ -f $duid_old ] && [ ! -f $dbdir/duid ]; then + echo "* Moving $duid_old to $dbdir/duid" >&2 + mv $duid_old $dbdir/duid + fi + if [ -f $secret_old ] && [ ! -f $dbdir/secret ]; then + echo "* Moving $secret_old to $dbdir/secret" >&2 + mv $secret_old $dbdir/secret + fi +fi + +exit 0 diff --git a/user/dhcpcd/fix-chrony-conf-location.patch b/user/dhcpcd/fix-chrony-conf-location.patch new file mode 100644 index 000000000..b75df9f37 --- /dev/null +++ b/user/dhcpcd/fix-chrony-conf-location.patch @@ -0,0 +1,11 @@ +--- a/hooks/50-ntp.conf ++++ b/hooks/50-ntp.conf +@@ -17,7 +17,7 @@ + # above examples. + + : ${ntp_confs:=ntp.conf ntpd.conf chrony.conf} +-: ${ntp_conf_dirs=/etc /usr/pkg/etc /usr/local/etc} ++: ${ntp_conf_dirs=/etc /etc/chrony /usr/pkg/etc /usr/local/etc} + ntp_conf_dir="$state_dir/ntp.conf" + + # If NTP_CONF is not set, work out a good default -- cgit v1.2.3-70-g09d2