summary refs log tree commit diff
path: root/pkgs/os-specific/linux/busybox
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2020-07-31 07:09:45 +0100
committerGitHub <noreply@github.com>2020-07-31 07:09:45 +0100
commitb75f2114eabc5c7f9aea1a9ce7142f494c5bc01c (patch)
treeae848f5d59cabaf971bab9cba30b232dbad9c81d /pkgs/os-specific/linux/busybox
parentae482bb41e24d1ff4f2241d749e75b52cba59a1d (diff)
parentb657c899d6fd5a09c3619302a20b63683a66f0f2 (diff)
downloadnixpkgs-b75f2114eabc5c7f9aea1a9ce7142f494c5bc01c.tar
nixpkgs-b75f2114eabc5c7f9aea1a9ce7142f494c5bc01c.tar.gz
nixpkgs-b75f2114eabc5c7f9aea1a9ce7142f494c5bc01c.tar.bz2
nixpkgs-b75f2114eabc5c7f9aea1a9ce7142f494c5bc01c.tar.lz
nixpkgs-b75f2114eabc5c7f9aea1a9ce7142f494c5bc01c.tar.xz
nixpkgs-b75f2114eabc5c7f9aea1a9ce7142f494c5bc01c.tar.zst
nixpkgs-b75f2114eabc5c7f9aea1a9ce7142f494c5bc01c.zip
Merge pull request #92581 from TethysSvensson/busybox-udhcpc-script
Diffstat (limited to 'pkgs/os-specific/linux/busybox')
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix24
1 files changed, 22 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index cbdedaa62a7..68fa2762aa6 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -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;
   };