mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
test: ask BusyBox its tools and recommended paths
Note: we need to add /usr/bin and /usr/sbin to the standard PATH
for tests and the test environment itself.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
# THE SOFTWARE.
|
||||
|
||||
set -eu
|
||||
export PATH=$PATH:/usr/bin:/usr/sbin
|
||||
|
||||
# It would have been nice to mount /dev as devtmpfs, but unfortunately
|
||||
# that's not possible if you're not privileged. For now tmpfs will
|
||||
|
||||
+12
-36
@@ -30,38 +30,16 @@ FINITBIN ?= ./sbin/finit
|
||||
|
||||
BBVER ?= 1.31.0
|
||||
BBBIN = busybox-$(ARCH)
|
||||
BBURL ?= https://www.busybox.net/downloads/binaries/$(BBVER)-defconfig-multiarch-musl/$(BBBIN)
|
||||
|
||||
binaries = $(DEST)/bin/awk \
|
||||
$(DEST)/bin/cat \
|
||||
$(DEST)/bin/cp \
|
||||
$(DEST)/bin/date \
|
||||
$(DEST)/bin/echo \
|
||||
$(DEST)/bin/env \
|
||||
$(DEST)/bin/find \
|
||||
$(DEST)/bin/grep \
|
||||
$(DEST)/bin/kill \
|
||||
$(DEST)/bin/ls \
|
||||
$(DEST)/bin/mkdir \
|
||||
$(DEST)/bin/mkfifo \
|
||||
$(DEST)/bin/mknod \
|
||||
$(DEST)/bin/mount \
|
||||
$(DEST)/bin/printf \
|
||||
$(DEST)/bin/pgrep \
|
||||
$(DEST)/bin/ps \
|
||||
$(DEST)/bin/rm \
|
||||
$(DEST)/bin/sh \
|
||||
$(DEST)/bin/sleep \
|
||||
$(DEST)/bin/tail \
|
||||
$(DEST)/bin/top \
|
||||
$(DEST)/bin/touch \
|
||||
$(DEST)/bin/start-stop-daemon
|
||||
BBHOME ?= https://www.busybox.net/downloads/binaries
|
||||
BBURL ?= $(BBHOME)/$(BBVER)-defconfig-multiarch-musl/$(BBBIN)
|
||||
|
||||
dirs = $(DEST)/bin \
|
||||
$(DEST)/dev \
|
||||
$(DEST)/etc \
|
||||
$(DEST)/proc \
|
||||
$(DEST)/sbin \
|
||||
$(DEST)/usr/bin \
|
||||
$(DEST)/usr/sbin \
|
||||
$(DEST)/var \
|
||||
$(DEST)/run \
|
||||
$(DEST)/sys \
|
||||
@@ -71,8 +49,12 @@ dirs = $(DEST)/bin \
|
||||
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
||||
libs = $(foreach path,$(_libs_src),$(abspath $(DEST))$(path))
|
||||
|
||||
all: $(dirs) $(binaries) $(libs) $(DEST)/bin/chrootsetup.sh
|
||||
all: $(dirs) $(libs) $(DEST)/bin/chrootsetup.sh $(DEST)/bin/$(BBBIN)
|
||||
touch $(DEST)/etc/fstab
|
||||
@(cd $(DEST); \
|
||||
for prg in `./bin/$(BBBIN) --list-full`; do \
|
||||
ln -sf /bin/$(BBBIN) $$prg; \
|
||||
done)
|
||||
|
||||
$(dirs):
|
||||
mkdir -p $@
|
||||
@@ -80,10 +62,9 @@ $(dirs):
|
||||
$(DEST)/bin/$(BBBIN).md5:
|
||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
||||
|
||||
.PHONY: $(DEST)/bin/$(BBBIN)
|
||||
$(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
||||
@cd $(dir $@)
|
||||
@if ! md5sum --status -c $(BBBIN).md5 2>/dev/null; then \
|
||||
@(cd $(dir $@); \
|
||||
if ! md5sum --status -c $(BBBIN).md5 2>/dev/null; then \
|
||||
if [ -d $(CACHE) ]; then \
|
||||
echo "Cannot find $(BBBIN), checking $(CACHE) ..."; \
|
||||
cd $(CACHE); \
|
||||
@@ -101,17 +82,12 @@ $(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
||||
fi; \
|
||||
cd $(dir $@); \
|
||||
md5sum -c $(BBBIN).md5; \
|
||||
fi
|
||||
fi)
|
||||
@chmod +x $@
|
||||
|
||||
$(DEST)/bin/chrootsetup.sh:
|
||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
||||
|
||||
$(binaries): $(DEST)/bin/$(BBBIN)
|
||||
cd $(DEST)/bin; \
|
||||
rm -f $(notdir $@); \
|
||||
ln -s $(BBBIN) $(notdir $@)
|
||||
|
||||
$(libs):
|
||||
mkdir -p $(dir $@)
|
||||
cp $(patsubst $(abspath $(DEST))%,%,$@) $@
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
|
||||
export TESTENV_PATH=/bin:/sbin:"@bindir@":"@sbindir@"
|
||||
export TESTENV_PATH=/bin:/sbin:/usr/bin:/usr/sbin:"@bindir@":"@sbindir@"
|
||||
export FINIT_CONF="@FINIT_CONF@"
|
||||
export FINIT_RCSD="@FINIT_RCSD@"
|
||||
|
||||
Reference in New Issue
Block a user