mirror of
https://github.com/troglobit/finit.git
synced 2026-10-26 12:14:37 +00:00
test: refactor test framework to use a rootfs skeleton
Instead of having to create files, and copying them in place for each test, we move all static test files to a skeleton rootfs. This makes it a lot easier to get an overview of how things and how they work. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
5c2577214d
commit
7f8a96a73e
49 files changed
+96
-70
No files matched your search
+16
-1
@@ -1,6 +1,21 @@
|
|||||||
SUBDIRS = common tenv
|
SUBDIRS = common tenv
|
||||||
|
|
||||||
EXTRA_DIST = setup-root.sh
|
EXTRA_DIST = skel/bin/busybox-x86_64.md5 skel/bin/service.sh skel/bin/slay \
|
||||||
|
skel/cdrom/.empty skel/dev/shm/.empty skel/dev/pts/.empty \
|
||||||
|
skel/etc/inittab skel/etc/hostname skel/etc/fstab \
|
||||||
|
skel/etc/init.d/rcS skel/etc/init.d/rcK skel/tmp/.empty \
|
||||||
|
skel/etc/init.d/S01-service.sh skel/home/.empty \
|
||||||
|
skel/proc/.empty skel/root/.empty skel/run/.empty \
|
||||||
|
skel/sbin/chrootsetup.sh skel/srv/.empty skel/sys/.empty \
|
||||||
|
skel/usr/bin/.empty skel/usr/lib/.empty skel/usr/sbin/.empty \
|
||||||
|
skel/usr/games/.empty skel/usr/src/.empty \
|
||||||
|
skel/usr/share/.empty skel/usr/include/.empty \
|
||||||
|
skel/usr/local/games/.empty skel/usr/local/sbin/.empty \
|
||||||
|
skel/usr/local/share/.empty skel/usr/local/src/.empty \
|
||||||
|
skel/usr/local/lib/.empty skel/usr/local/bin/.empty \
|
||||||
|
skel/usr/local/etc/.empty skel/var/run
|
||||||
|
|
||||||
|
EXTRA_DIST += setup-root.sh
|
||||||
EXTRA_DIST += add-remove-dynamic-service.sh
|
EXTRA_DIST += add-remove-dynamic-service.sh
|
||||||
EXTRA_DIST += add-remove-dynamic-service-sub-config.sh
|
EXTRA_DIST += add-remove-dynamic-service-sub-config.sh
|
||||||
EXTRA_DIST += start-stop-service.sh
|
EXTRA_DIST += start-stop-service.sh
|
||||||
|
|||||||
@@ -13,15 +13,12 @@ test_teardown()
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_RCSD/service.conf"
|
texec rm -f "$FINIT_RCSD/service.conf"
|
||||||
texec rm -f /test_assets/service.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
|
|
||||||
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
|
|
||||||
say "Add a dynamic service in $FINIT_RCSD/service.conf"
|
say "Add a dynamic service in $FINIT_RCSD/service.conf"
|
||||||
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh -- Dyn serv' > $FINIT_RCSD/service.conf"
|
texec sh -c "echo 'service [2345] kill:20 log service.sh -- Dyn serv' > $FINIT_RCSD/service.conf"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
texec sh -c "initctl reload"
|
texec sh -c "initctl reload"
|
||||||
|
|||||||
@@ -13,15 +13,12 @@ test_teardown()
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_CONF"
|
texec rm -f "$FINIT_CONF"
|
||||||
texec rm -f /test_assets/service.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
|
|
||||||
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
|
|
||||||
say "Add a dynamic service in $FINIT_CONF"
|
say "Add a dynamic service in $FINIT_CONF"
|
||||||
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh -- Dyn service' > $FINIT_CONF"
|
texec sh -c "echo 'service [2345] kill:20 log service.sh -- Dyn service' > $FINIT_CONF"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
texec sh -c "initctl reload"
|
texec sh -c "initctl reload"
|
||||||
|
|||||||
@@ -1,4 +1,2 @@
|
|||||||
EXTRA_DIST = service.conf service.sh S01-service.sh slay.sh
|
|
||||||
|
|
||||||
noinst_PROGRAMS = serv
|
noinst_PROGRAMS = serv
|
||||||
serv_SOURCES = serv.c
|
serv_SOURCES = serv.c
|
||||||
@@ -1 +0,0 @@
|
|||||||
service [2345] kill:20 log /test_assets/service.sh
|
|
||||||
@@ -4,6 +4,7 @@ set -eu
|
|||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
make -C "$top_builddir" DESTDIR="$TENV_ROOT" install
|
make -C "$top_builddir" DESTDIR="$TENV_ROOT" install
|
||||||
|
cp "$top_builddir/test/common/serv" "$TENV_ROOT/sbin/"
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
FINITBIN="$(pwd)/$top_builddir/src/finit" DEST="$TENV_ROOT" make -f "$srcdir/tenv/root.mk"
|
FINITBIN="$(pwd)/$top_builddir/src/finit" DEST="$TENV_ROOT" make -f "$srcdir/tenv/root.mk"
|
||||||
|
|||||||
@@ -14,18 +14,15 @@ test_teardown()
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_CONF"
|
texec rm -f "$FINIT_CONF"
|
||||||
texec rm -f /test_assets/service.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
|
|
||||||
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
|
|
||||||
say 'Ensure file system is cleared'
|
say 'Ensure file system is cleared'
|
||||||
texec rm -f /tmp/usr1.log
|
texec rm -f /tmp/usr1.log
|
||||||
|
|
||||||
say "Add service stanza in $FINIT_CONF"
|
say "Add service stanza in $FINIT_CONF"
|
||||||
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh -- Test service' > $FINIT_CONF"
|
texec sh -c "echo 'service [2345] kill:20 log service.sh -- Test service' > $FINIT_CONF"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
texec sh -c "initctl reload"
|
texec sh -c "initctl reload"
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1 @@
|
|||||||
|
test
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# SysV style start script for service.sh
|
# SysV style start script for service.sh
|
||||||
|
|
||||||
DAEMON="/test_assets/service.sh"
|
DAEMON="/sbin/service.sh"
|
||||||
PIDFILE="/var/run/service.pid"
|
PIDFILE="/var/run/service.pid"
|
||||||
|
|
||||||
start()
|
start()
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Shutting down ..."
|
||||||
|
exit 0
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Starting up ..."
|
||||||
|
poweroff -d 2
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# /etc/inittab
|
||||||
|
#
|
||||||
|
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
|
||||||
|
#
|
||||||
|
# Note: BusyBox init doesn't support runlevels. The runlevels field is
|
||||||
|
# completely ignored by BusyBox init. If you want runlevels, use
|
||||||
|
# sysvinit.
|
||||||
|
#
|
||||||
|
# Format for each entry: <id>:<runlevels>:<action>:<process>
|
||||||
|
#
|
||||||
|
# id == tty to run on, or empty for /dev/console
|
||||||
|
# runlevels == ignored
|
||||||
|
# action == one of sysinit, respawn, askfirst, wait, and once
|
||||||
|
# process == program to run
|
||||||
|
|
||||||
|
# Startup the system
|
||||||
|
#::sysinit:/bin/mount -t proc proc /proc
|
||||||
|
#::sysinit:/bin/mount -o remount,rw /
|
||||||
|
#::sysinit:/bin/mkdir -p /dev/pts /dev/shm
|
||||||
|
#::sysinit:/bin/mount -a
|
||||||
|
#::sysinit:/bin/mkdir -p /run/lock/subsys
|
||||||
|
#::sysinit:/sbin/swapon -a
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||||
|
::sysinit:/bin/hostname -F /etc/hostname
|
||||||
|
# now run any rc scripts
|
||||||
|
::sysinit:/etc/init.d/rcS
|
||||||
|
|
||||||
|
# Put a getty on the serial port
|
||||||
|
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
|
||||||
|
|
||||||
|
# Stuff to do for the 3-finger salute
|
||||||
|
#::ctrlaltdel:/sbin/reboot
|
||||||
|
|
||||||
|
# Stuff to do before rebooting
|
||||||
|
::shutdown:/etc/init.d/rcK
|
||||||
|
#::shutdown:/sbin/swapoff -a
|
||||||
|
#::shutdown:/bin/umount -a -r
|
||||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -12,7 +12,7 @@
|
|||||||
# furnished to do so, subject to the following conditions:
|
# furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
# The above copyright notice and this permission notice shall be included in
|
# The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
# all copies or substantial portions of the Software.
|
||||||
#
|
#
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
@@ -29,6 +29,8 @@ export PATH=$PATH:/usr/bin:/usr/sbin
|
|||||||
# that's not possible if you're not privileged. For now tmpfs will
|
# that's not possible if you're not privileged. For now tmpfs will
|
||||||
# have to do.
|
# have to do.
|
||||||
mount -n -t tmpfs none /dev
|
mount -n -t tmpfs none /dev
|
||||||
|
# Silence BusyBox init
|
||||||
|
touch /dev/null
|
||||||
|
|
||||||
mount -t proc none /proc
|
mount -t proc none /proc
|
||||||
mount -t sysfs none /sys
|
mount -t sysfs none /sys
|
||||||
File renamed without changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../run
|
||||||
@@ -15,17 +15,13 @@ test_teardown()
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_CONF"
|
texec rm -f "$FINIT_CONF"
|
||||||
texec rm -f /test_assets/service.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
|
|
||||||
cp "$TEST_DIR"/common/slay.sh "$TENV_ROOT"/test_assets/
|
|
||||||
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
rm -f "$TENV_ROOT"/oldpid
|
rm -f "$TENV_ROOT"/oldpid
|
||||||
|
|
||||||
say "Add service stanza in $FINIT_CONF"
|
say "Add service stanza in $FINIT_CONF"
|
||||||
texec sh -c "echo 'service [2345] respawn log /test_assets/service.sh -- Test service' > $FINIT_CONF"
|
texec sh -c "echo 'service [2345] respawn log service.sh -- Test service' > $FINIT_CONF"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
texec sh -c "initctl reload"
|
texec sh -c "initctl reload"
|
||||||
@@ -40,7 +36,7 @@ laps=1000
|
|||||||
while [ $i -lt $laps ]; do
|
while [ $i -lt $laps ]; do
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
say "Lap $i/$laps, killing service ..." # we have this, no sleep needed
|
say "Lap $i/$laps, killing service ..." # we have this, no sleep needed
|
||||||
texec sh -c "/test_assets/slay.sh service.sh"
|
texec sh -c "slay service.sh"
|
||||||
done
|
done
|
||||||
|
|
||||||
retry 'assert_new_pid service.sh /run/service.pid'
|
retry 'assert_new_pid service.sh /run/service.pid'
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ TEST_DIR=$(dirname "$0")
|
|||||||
test_setup()
|
test_setup()
|
||||||
{
|
{
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
cp "$TENV_ROOT"/../common/serv "$TENV_ROOT"/test_assets/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test_teardown()
|
test_teardown()
|
||||||
@@ -15,7 +14,6 @@ test_teardown()
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_CONF"
|
texec rm -f "$FINIT_CONF"
|
||||||
texec rm -f /test_assets/serv
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test_one()
|
test_one()
|
||||||
@@ -57,12 +55,12 @@ test_one()
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. "$TEST_DIR/tenv/lib.sh"
|
. "$TEST_DIR/tenv/lib.sh"
|
||||||
|
|
||||||
test_one "/run/serv.pid" "service pid:!/run/serv.pid /test_assets/serv -- Forking service, type 1"
|
test_one "/run/serv.pid" "service pid:!/run/serv.pid serv -- Forking service, type 1"
|
||||||
test_one "/run/serv.pid" "service type:forking /test_assets/serv -- Forking service, type 2"
|
test_one "/run/serv.pid" "service type:forking serv -- Forking service, type 2"
|
||||||
# This one could never be started by and monitored by Finit: it forks to
|
# This one could never be started by and monitored by Finit: it forks to
|
||||||
# background and does not create a PID file. Essentially it's lost to
|
# background and does not create a PID file. Essentially it's lost to
|
||||||
# Finit, and any other sane process monitor.
|
# Finit, and any other sane process monitor.
|
||||||
#test_one "/run/serv.pid" "service pid:/run/serv.pid /test_assets/serv -p -- Forking service w/o PID file"
|
#test_one "/run/serv.pid" "service pid:/run/serv.pid serv -p -- Forking service w/o PID file"
|
||||||
test_one "/run/serv.pid" "service pid:/run/serv.pid /test_assets/serv -n -- Foreground service w/o PID file"
|
test_one "/run/serv.pid" "service pid:/run/serv.pid serv -n -- Foreground service w/o PID file"
|
||||||
test_one "/run/serv.pid" "service /test_assets/serv -n -p -- Foreground service w/ PID file"
|
test_one "/run/serv.pid" "service serv -n -p -- Foreground service w/ PID file"
|
||||||
test_one "/run/servy.pid" "service pid:/run/servy.pid /test_assets/serv -n -p -P /run/servy.pid -- Foreground service w/ custom PID file"
|
test_one "/run/servy.pid" "service pid:/run/servy.pid serv -n -p -P /run/servy.pid -- Foreground service w/ custom PID file"
|
||||||
@@ -13,19 +13,19 @@ test_teardown()
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_RCSD/service.conf"
|
texec rm -f "$FINIT_RCSD/service.conf"
|
||||||
texec rm -f /test_assets/service.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
|
|
||||||
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
|
|
||||||
say "Add service stanza in $FINIT_RCSD/service.conf"
|
say "Add service stanza in $FINIT_RCSD/service.conf"
|
||||||
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh -- Subserv' > $FINIT_RCSD/service.conf"
|
texec sh -c "echo 'service [2345] kill:20 log service.sh -- Subserv' > $FINIT_RCSD/service.conf"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
texec sh -c "initctl reload"
|
texec sh -c "initctl reload"
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
texec sh -c "ps"
|
||||||
|
|
||||||
retry 'assert_num_children 1 service.sh'
|
retry 'assert_num_children 1 service.sh'
|
||||||
|
|
||||||
say 'Stop the service'
|
say 'Stop the service'
|
||||||
|
|||||||
@@ -13,15 +13,12 @@ test_teardown()
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_CONF"
|
texec rm -f "$FINIT_CONF"
|
||||||
texec rm -f /test_assets/service.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
|
|
||||||
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
|
|
||||||
say "Add service stanza in $FINIT_CONF"
|
say "Add service stanza in $FINIT_CONF"
|
||||||
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh -- Test service' > $FINIT_CONF"
|
texec sh -c "echo 'service [2345] kill:20 log service.sh -- Test service' > $FINIT_CONF"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
texec sh -c "initctl reload"
|
texec sh -c "initctl reload"
|
||||||
|
|||||||
@@ -12,17 +12,12 @@ test_teardown() {
|
|||||||
say "Running test teardown."
|
say "Running test teardown."
|
||||||
|
|
||||||
texec rm -f "$FINIT_CONF"
|
texec rm -f "$FINIT_CONF"
|
||||||
texec rm -f /test_assets/service.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
say "Test start $(date)"
|
say "Test start $(date)"
|
||||||
|
|
||||||
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
cp "$TEST_DIR"/common/S01-service.sh "$TENV_ROOT"/test_assets/
|
|
||||||
chmod +x "$TENV_ROOT"/test_assets/*.sh
|
|
||||||
|
|
||||||
say "Add sysv stanza in $FINIT_CONF"
|
say "Add sysv stanza in $FINIT_CONF"
|
||||||
texec sh -c "echo 'sysv [2345] pid:!/run/service.pid name:service.sh /test_assets/S01-service.sh -- SysV test service' > $FINIT_CONF"
|
texec sh -c "echo 'sysv [2345] pid:!/run/service.pid name:service.sh /etc/init.d/S01-service.sh -- SysV test service' > $FINIT_CONF"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
texec sh -c "initctl reload"
|
texec sh -c "initctl reload"
|
||||||
|
|||||||
+6
-23
@@ -20,8 +20,9 @@
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
DEST ?= ../tenv-root
|
|
||||||
srcdir ?= ../
|
srcdir ?= ../
|
||||||
|
SKEL ?= $(srcdir)/skel
|
||||||
|
DEST ?= ../tenv-root
|
||||||
|
|
||||||
CACHE ?= ~/.cache
|
CACHE ?= ~/.cache
|
||||||
ARCH ?= x86_64
|
ARCH ?= x86_64
|
||||||
@@ -33,34 +34,19 @@ BBBIN = busybox-$(ARCH)
|
|||||||
BBHOME ?= https://www.busybox.net/downloads/binaries
|
BBHOME ?= https://www.busybox.net/downloads/binaries
|
||||||
BBURL ?= $(BBHOME)/$(BBVER)-defconfig-multiarch-musl/$(BBBIN)
|
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 \
|
|
||||||
$(DEST)/test_assets \
|
|
||||||
$(DEST)/tmp
|
|
||||||
|
|
||||||
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
||||||
libs = $(foreach path,$(_libs_src),$(abspath $(DEST))$(path))
|
libs = $(foreach path,$(_libs_src),$(abspath $(DEST))$(path))
|
||||||
|
|
||||||
all: $(dirs) $(libs) $(DEST)/bin/chrootsetup.sh $(DEST)/bin/$(BBBIN)
|
all: $(libs) $(DEST)/bin/$(BBBIN)
|
||||||
touch $(DEST)/etc/fstab
|
|
||||||
@(cd $(DEST); \
|
@(cd $(DEST); \
|
||||||
for prg in `./bin/$(BBBIN) --list-full`; do \
|
for prg in `./bin/$(BBBIN) --list-full`; do \
|
||||||
ln -sf /bin/$(BBBIN) $$prg; \
|
ln -sf /bin/$(BBBIN) $$prg; \
|
||||||
done)
|
done)
|
||||||
|
|
||||||
$(dirs):
|
|
||||||
mkdir -p $@
|
|
||||||
|
|
||||||
$(DEST)/bin/$(BBBIN).md5:
|
$(DEST)/bin/$(BBBIN).md5:
|
||||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
@mkdir -p $(DEST)
|
||||||
|
@cp -a $(SKEL)/* $(DEST)/
|
||||||
|
@find $(DEST) -name .empty -delete
|
||||||
|
|
||||||
$(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
$(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
||||||
@(cd $(dir $@); \
|
@(cd $(dir $@); \
|
||||||
@@ -85,9 +71,6 @@ $(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
|||||||
fi)
|
fi)
|
||||||
@chmod +x $@
|
@chmod +x $@
|
||||||
|
|
||||||
$(DEST)/bin/chrootsetup.sh:
|
|
||||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
|
||||||
|
|
||||||
$(libs):
|
$(libs):
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
cp $(patsubst $(abspath $(DEST))%,%,$@) $@
|
cp $(patsubst $(abspath $(DEST))%,%,$@) $@
|
||||||
+1
-1
@@ -46,4 +46,4 @@ exec "$unshare" \
|
|||||||
--mount \
|
--mount \
|
||||||
--mount-proc \
|
--mount-proc \
|
||||||
--uts --ipc --net \
|
--uts --ipc --net \
|
||||||
"$chroot" "$TENV_ROOT" /bin/chrootsetup.sh "$@"
|
"$chroot" "$TENV_ROOT" /sbin/chrootsetup.sh "$@"
|
||||||
Reference in new issue
Block a user