From 29f223f7f1360c4c6b4f8a1f8cffffa5b09bcd7f Mon Sep 17 00:00:00 2001 From: Benjamin Grange Date: Mon, 9 Dec 2019 16:55:32 +0100 Subject: [PATCH] Add the manifest to build `sys-apps/dhcpcd`. --- sys-apps/dhcpcd/dhcpcd.py | 55 +++++++++++++++++++++++++++++++++ sys-apps/dhcpcd/dhcpcd.service | 12 +++++++ sys-apps/dhcpcd/instructions.sh | 22 +++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 sys-apps/dhcpcd/dhcpcd.py create mode 100644 sys-apps/dhcpcd/dhcpcd.service create mode 100644 sys-apps/dhcpcd/instructions.sh diff --git a/sys-apps/dhcpcd/dhcpcd.py b/sys-apps/dhcpcd/dhcpcd.py new file mode 100644 index 0000000..128f1f6 --- /dev/null +++ b/sys-apps/dhcpcd/dhcpcd.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3.6 +# -*- coding: utf-8 -*- + +import stdlib +from stdlib.template.configure import configure +from stdlib.split.drain_all import drain_all_with_doc +from stdlib.template.make import make +from stdlib.template import autotools +from stdlib.manifest import manifest + + +@manifest( + name='dhcpcd', + category='sys-apps', + description=''' + A DHCP client daemon compliant with RFC2131. + ''', + tags=['net', 'network', 'dhcp' 'rfc2131'], + maintainer='grange_c@raven-os.org', + licenses=[stdlib.license.License.BSD], + upstream_url='https://roy.marples.name/projects/dhcpcd/', + kind=stdlib.kind.Kind.EFFECTIVE, + versions_data=[ + { + 'semver': '8.0.3', + 'fetch': [{ + 'url': 'https://roy.marples.name/downloads/dhcpcd/dhcpcd-8.0.3.tar.xz', + 'sha256': '9674971fcd5acd5a3401a0ad8eba7f0b816fec9abb4a2520332b4d8dae068f1d', + }, { + 'file': './dhcpcd.service', + } + ], + }, + ], + build_dependencies=[ + 'sys-apps/systemd-dev', + ] +) +def build(build): + packages = autotools.build( + configure=lambda: configure( + '--disable-static', + '--without-static', + ), + install=lambda: make('install'), + split=drain_all_with_doc, + ) + + # Drain the systemd daemon + packages['sys-apps/dhcpcd'].drain_build_cache('dhcpcd.service', 'usr/lib64/systemd/system/') + + # Start the daemon when the dhcpcd is installed + packages['sys-apps/dhcpcd'].load_instructions('./instructions.sh') + + return packages diff --git a/sys-apps/dhcpcd/dhcpcd.service b/sys-apps/dhcpcd/dhcpcd.service new file mode 100644 index 0000000..910378d --- /dev/null +++ b/sys-apps/dhcpcd/dhcpcd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Lightweight DHCP client daemon +Wants=network.target +Before=network.target network-online.target + +[Service] +Type=forking +ExecStart=/bin/dhcpcd -q +PIDFile=/run/dhcpcd.pid + +[Install] +WantedBy=multi-user.target diff --git a/sys-apps/dhcpcd/instructions.sh b/sys-apps/dhcpcd/instructions.sh new file mode 100644 index 0000000..9ac41b6 --- /dev/null +++ b/sys-apps/dhcpcd/instructions.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +before_install() { + : +} + +after_install() { + systemctl enable dhcpcd + + if [[ $(pidof "systemd") ]]; then + systemctl daemon-reload + systemctl start dhcpcd + fi +} + +before_remove() { + : +} + +after_remove() { + : +}