make busybox tools available in default $PATH
[rpi_small] / Makefile
index 5d4e7f0..58c32d9 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