Compare commits

...
2 Commits
Author SHA1 Message Date
Jacques de Laval 50c99762f1 Add run target for running Finit as a stand alone unprivileged process
It could be very useful, during development, to be able to run Finit on a
host system without having to provision a full VM. We have all the building
blocks for easily containerizing Finit - in the test framework - so adding
a "run" target that does the orchestration makes sense.

Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-03-05 01:39:42 +01:00
Jacques de Laval 067043b298 test: Use STDOUT of parent process instead of a pipe as tty for finit
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-03-05 01:24:31 +01:00
7 changed files with 27 additions and 12 deletions
+16
View File
@@ -29,3 +29,19 @@ release: distcheck
printf "$$file.md5\t"; cat ../$$file.md5 | cut -f1 -d' '; \ printf "$$file.md5\t"; cat ../$$file.md5 | cut -f1 -d' '; \
printf "$$file.sha256\t"; cat ../$$file.sha256 | cut -f1 -d' '; \ printf "$$file.sha256\t"; cat ../$$file.sha256 | cut -f1 -d' '; \
done done
run:
srcdir=@srcdir@/test \
top_builddir=@top_builddir@ \
TENV_ROOT=$(tenv_root) \
@srcdir@/test/setup-root.sh
mkdir -p $(dir $(tenv_root)/@FINIT_CONF@)
echo 'tty [12345] @console linux noclear nologin' > $(tenv_root)/@FINIT_CONF@
-TENV_ROOT=$(tenv_root) \
TESTENV_PATH=@sbindir@:/bin \
FINIT_RCSD=@FINIT_RCSD@ \
test/tenv/start.sh finit
run : tenv_root ?= @abs_top_builddir@/run-rootfs
+4 -1
View File
@@ -224,6 +224,9 @@ AC_DEFINE_UNQUOTED(RESCUE_CONF, "$rescue_conf", [Finit rescue mode .conf])
AC_EXPAND_DIR(sample_conf, "$libdir/finit/sample.conf") AC_EXPAND_DIR(sample_conf, "$libdir/finit/sample.conf")
AC_DEFINE_UNQUOTED(SAMPLE_CONF, "$sample_conf", [Finit sameple.conf for initctl create]) AC_DEFINE_UNQUOTED(SAMPLE_CONF, "$sample_conf", [Finit sameple.conf for initctl create])
AC_EXPAND_DIR(path_stdpath, "$sbindir:$bindir:/usr/sbin:/usr/bin:/sbin:/bin")
AC_DEFINE_UNQUOTED(_PATH_STDPATH, "$path_stdpath", [Default PATH])
# Generate all files # Generate all files
AC_OUTPUT AC_OUTPUT
@@ -232,7 +235,7 @@ cat <<EOF
------------------ Summary ------------------ ------------------ Summary ------------------
$PACKAGE_NAME version $PACKAGE_VERSION $PACKAGE_NAME version $PACKAGE_VERSION
Prefix................: $prefix Prefix................: $prefix
Exec prefix...........: $eprefix Exec prefix...........: `eval echo $exec_prefix`
Sysconfdir............: `eval echo $sysconfdir` Sysconfdir............: `eval echo $sysconfdir`
Localstatedir.........: `eval echo $localstatedir` Localstatedir.........: `eval echo $localstatedir`
Finit config file.....: $conf_path Finit config file.....: $conf_path
-5
View File
@@ -36,11 +36,6 @@
#include <lite/lite.h> #include <lite/lite.h>
#include <uev/uev.h> #include <uev/uev.h>
/* just in case */
#ifndef _PATH_STDPATH
#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
#endif
#ifndef _PATH_VARRUN #ifndef _PATH_VARRUN
#define _PATH_VARRUN "/var/run/" #define _PATH_VARRUN "/var/run/"
#endif #endif
+1 -1
View File
@@ -44,6 +44,6 @@ fi
mkdir -p "$FINIT_RCSD" mkdir -p "$FINIT_RCSD"
tty=/dev/$(cat /sys/class/tty/console/active) tty=/dev/$(cat /sys/class/tty/console/active)
mkfifo "$tty" ln -fs /shared/pts "$tty"
exec "$@" exec "$@"
-4
View File
@@ -138,7 +138,3 @@ echo "$finit_ppid" > "$TENV_ROOT"/running_test.pid
log "$color_reset" 'Setup of test environment done' '' log "$color_reset" 'Setup of test environment done' ''
finit_pid=$(retry "pgrep -P $finit_ppid") finit_pid=$(retry "pgrep -P $finit_ppid")
tty=/dev/$(texec cat /sys/class/tty/console/active)
texec cat "$tty" &
sleep 1
+2
View File
@@ -38,6 +38,7 @@ binaries = $(DEST)/bin/cat \
$(DEST)/bin/env \ $(DEST)/bin/env \
$(DEST)/bin/find \ $(DEST)/bin/find \
$(DEST)/bin/kill \ $(DEST)/bin/kill \
$(DEST)/bin/ln \
$(DEST)/bin/ls \ $(DEST)/bin/ls \
$(DEST)/bin/mkdir \ $(DEST)/bin/mkdir \
$(DEST)/bin/mkfifo \ $(DEST)/bin/mkfifo \
@@ -57,6 +58,7 @@ dirs = $(DEST)/bin \
$(DEST)/etc \ $(DEST)/etc \
$(DEST)/proc \ $(DEST)/proc \
$(DEST)/sbin \ $(DEST)/sbin \
$(DEST)/shared \
$(DEST)/sys \ $(DEST)/sys \
$(DEST)/test_assets \ $(DEST)/test_assets \
$(DEST)/tmp $(DEST)/tmp
+4 -1
View File
@@ -45,4 +45,7 @@ exec "$unshare" \
--mount \ --mount \
--mount-proc \ --mount-proc \
--uts --ipc --net \ --uts --ipc --net \
"$chroot" "$TENV_ROOT" /bin/chrootsetup.sh "$@" sh -c "
ln -fs /proc/1/fd/1 $TENV_ROOT/shared/pts;
exec $chroot $TENV_ROOT /bin/chrootsetup.sh $*
"