changeset 165:d0d5241837d4

network/dhcpcd: initial import, closes #1140
author David Demelier <markand@malikania.fr>
date Thu, 14 Mar 2019 12:58:34 +0100
parents 9d41f3f5dcba
children 7341bef28067
files network/dhcpcd/dhcpcd network/dhcpcd/dhcpcd.sh
diffstat 2 files changed, 119 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/network/dhcpcd/dhcpcd	Thu Mar 14 12:58:34 2019 +0100
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# /etc/rc.d/dhcpcd: run control script for dhcpcd
+
+if [ -f /etc/rc.conf ]; then
+	source /etc/rc.conf
+fi
+
+: ${DHCPCD_CMD:=/usr/sbin/dhcpcd}
+: ${DHCPCD_ARGS:=-q -b}
+: ${DHCPCD_PID:=/var/run/dhcpcd.pid}
+
+dhcpcd_start()
+{
+	echo "Starting dhcpcd: $DHCPCD_CMD $DHCPCD_ARGS"
+	$DHCPCD_CMD $DHCPCD_ARGS -p $DHCPCD_PID
+}
+
+dhcpcd_status()
+{
+	if [ -s $DHCPCD_PID ]; then
+		echo "dhcpcd is running with pid: `cat $DHCPCD_PID`"
+	else
+		echo "dhcpcd is not running"
+	fi
+}
+
+dhcpcd_stop()
+{
+	if [ -s $DHCPCD_PID ]; then
+		echo "Stopping dhcpcd..."
+		$DHCPCD_CMD -x
+	fi
+}
+
+dhcpcd_restart()
+{
+	dhcpcd_stop
+	sleep 3
+	dhcpcd_start
+}
+
+case $1 in
+start)
+	dhcpcd_start
+	;;
+status)
+	dhcpcd_status
+	;;
+stop)
+	dhcpcd_stop
+	;;
+restart)
+	dhcpcd_restart
+	;;
+*)
+	echo "usage: $(basename $0) restart|start|status|stop"
+	;;
+esac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/network/dhcpcd/dhcpcd.sh	Thu Mar 14 12:58:34 2019 +0100
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+PKGNAME=dhcpcd
+PKGVERSION=7.0.8
+PKGREVISION=1
+PKGLICENSE="BSD"
+PKGSUMMARY="DHCP client daemon"
+PKGDOWNLOAD="https://roy.marples.name/downloads/$PKGNAME/$PKGNAME-$PKGVERSION.tar.xz"
+PKGOPTIONS="IPV6"
+PKGPROTECT="etc/dhcpcd.conf etc/rc.d/dhcpcd"
+
+: ${CHOST:=$(uname -m)-linux-musl}
+: ${CBUILD:=$(uname -m)-linux-musl}
+: ${CTARGET:=$(uname -m)-linux-musl}
+: ${CC:=gcc}
+: ${CFLAGS:=-O2}
+: ${LDFLAGS:=}
+: ${LIBS:=}
+: ${IPV6:=yes}
+
+build()
+{
+	rm -rf $PKGNAME-$PKGVERSION
+	tar xvaf $PKGNAME-$PKGVERSION.tar.xz
+	pushd $PKGNAME-$PKGVERSION
+
+	CC="$CC" \
+	CFLAGS="$CFLAGS" \
+	LDFLAGS="$LDFLAGS" \
+	LIBS="$LIBS" \
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--target=$CTARGET \
+		--prefix=/usr \
+		--sysconfdir=/etc \
+		--disable-static \
+		--enable-shared
+	make
+	make install DESTDIR=$DESTDIR
+	install -D -m 0644 ../dhcpcd $DESTDIR/etc/rc.d/dhcpcd
+
+	popd
+	rm -rf $PKGNAME-$PKGVERSION
+}