Merge pull request #92581 from TethysSvensson/busybox-udhcpc-script

This commit is contained in:
Jörg Thalheim 2020-07-31 07:09:45 +01:00 committed by GitHub
commit b75f2114ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 2 deletions

View file

@ -8022,6 +8022,12 @@
githubId = 26417242;
name = "Mikolaj Galkowski";
};
TethysSvensson = {
email = "freaken@freaken.dk";
github = "TethysSvensson";
githubId = 4294434;
name = "Tethys Svensson";
};
teto = {
email = "mcoudron@hotmail.com";
github = "teto";

View file

@ -1,4 +1,4 @@
{ stdenv, lib, buildPackages, fetchurl
{ stdenv, lib, buildPackages, fetchurl, fetchzip
, enableStatic ? false
, enableMinimal ? false
# Allow forcing musl without switching stdenv itself, e.g. for our bootstrapping:
@ -31,6 +31,14 @@ let
CONFIG_FEATURE_UTMP n
CONFIG_FEATURE_WTMP n
'';
debianName = "busybox_1.30.1-5";
debianTarball = fetchzip {
url = "http://deb.debian.org/debian/pool/main/b/busybox/${debianName}.debian.tar.xz";
sha256 = "03m4rvs2pd0hj0mdkdm3r4m1gh0bgwr0cvnqds297xnkfi5s01nx";
};
debianDispatcherScript = "${debianTarball}/tree/udhcpc/etc/udhcpc/default.script";
outDispatchPath = "$out/default.script";
in
stdenv.mkDerivation rec {
@ -81,6 +89,9 @@ stdenv.mkDerivation rec {
# Bump from 4KB, much faster I/O
CONFIG_FEATURE_COPYBUF_KB 64
# Set the path for the udhcpc script
CONFIG_UDHCPC_DEFAULT_SCRIPT "${outDispatchPath}"
${extraConfig}
CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.targetPrefix}"
${libcConfig}
@ -95,6 +106,15 @@ stdenv.mkDerivation rec {
makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}cc -isystem ${musl.dev}/include -B${musl}/lib -L${musl}/lib")
'';
postInstall = ''
sed -e '
1 a busybox() { '$out'/bin/busybox "$@"; }\
logger() { '$out'/bin/logger "$@"; }\
' ${debianDispatcherScript} > ${outDispatchPath}
chmod 555 ${outDispatchPath}
PATH=$out/bin patchShebangs ${outDispatchPath}
'';
depsBuildBuild = [ buildPackages.stdenv.cc ];
buildInputs = lib.optionals (enableStatic && !useMusl && stdenv.cc.libc ? static) [ stdenv.cc.libc stdenv.cc.libc.static ];
@ -107,7 +127,7 @@ stdenv.mkDerivation rec {
description = "Tiny versions of common UNIX utilities in a single small executable";
homepage = "https://busybox.net/";
license = licenses.gpl2;
maintainers = with maintainers; [ ];
maintainers = with maintainers; [ TethysSvensson ];
platforms = platforms.linux;
priority = 10;
};