]> git.plutz.net Git - rpi_small/commitdiff
make busybox tools available in default $PATH
authorPaul Hänsch <paul@plutz.net>
Sat, 9 Mar 2019 23:36:53 +0000 (00:36 +0100)
committerPaul Hänsch <paul@plutz.net>
Sat, 9 Mar 2019 23:36:53 +0000 (00:36 +0100)
Makefile
files/etc/profile.d/busybox.sh [new file with mode: 0644]

index 5d4e7f08728faa4288156166ea9f1269a2adea05..58c32d96fc351d068b4fa4622a836ad5f06b151c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ config.mk: config.example
        cp -n "$<" "$@"
 include config.mk
 
-.PHONY: imgfile imgmount root_copy norecommends apt_keys wifi_cfg ssh_key
+.PHONY: imgfile imgmount root_copy norecommends apt_keys wifi_cfg ssh_key busybox
 
 export SOURCES
 export WIFI_CFG
@@ -96,18 +96,22 @@ root_copy: imgmount raspi_root/ files/
 id_rsa.pub:
        ssh-keygen -b 2048 -t rsa -N '' -f id_rsa
 
-ssh_key: imgmount id_rsa.pub
+ssh_key: imgmount root_copy id_rsa.pub
        mkdir -p "$</root/.ssh/"
        cat id_rsa.pub >>"$</root/.ssh/authorized_keys"
        chmod 700 "$</root" "$</root/.ssh"
        chmod 600 "$</root/.ssh/authorized_keys"
 
-wifi_cfg: imgmount
+wifi_cfg: imgmount root_copy
        printf '%s\n' "$$WIFI_CFG" >"$</etc/network/interfaces.d/wifi"
        chmod 644 "$</etc/network/interfaces.d/wifi"
        chroot "$<" systemctl disable systemd-networkd-wait-online.service
 
-${IMGFILE}: imgmount root_copy wifi_cfg ssh_key
+busybox: imgmount root_copy
+       mkdir -p -m 755 "$</opt/busybox"
+       chroot "$<" busybox --install -s /opt/busybox
+
+${IMGFILE}: imgmount root_copy wifi_cfg ssh_key busybox
        umount "$</boot/" "$</"
        losetup -a |sed -En '/${IMGFILE}/{s;^([^:]+):.*$$;\1;p;q}' |xargs losetup -d
        losetup -a |sed -En '/${IMGFILE}/{s;^([^:]+):.*$$;\1;p;q}' |xargs losetup -d
diff --git a/files/etc/profile.d/busybox.sh b/files/etc/profile.d/busybox.sh
new file mode 100644 (file)
index 0000000..eb86f2b
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+PATH="${PATH:/opt/busybox}"