From d9e2c6ca4b22257820028df3adcd9bd290c12e24 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 21 Nov 2022 21:26:01 +0100 Subject: make container write logs to a directory shared with host --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2b179a2..9c02eec 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,8 @@ GUIX_SHELL = $(GUIX_TM) shell KOSZKO_ORG_WEBSITE_INFO = \ subrepos/koszko-org-website/src/koszko_org_website.egg-info/PKG-INFO +LOGDIR = "/tmp/$$(pwd | sed 's|/|!|g')!log" + all: | container-runner.touchfile log $(KOSZKO_ORG_WEBSITE_INFO): @@ -43,18 +45,18 @@ hosts: hosts-extra /etc/hosts cat $^ > $@ log: - mkdir -p log + ln -sf $(LOGDIR) $@ start-container: guix-container.sh container-runner.touchfile | log - unshare --mount ./run-with-fake-mounts.sh \ - ./$< start -e ./container-runner -p ./pidfile -l ./log + unshare --mount ./run-with-fake-mounts.sh $(LOGDIR) \ + ./$< start -e ./container-runner -p ./pidfile -l $(LOGDIR) stop-container: guix-container.sh ./$< stop -e ./container-runner -p ./pidfile restart-container: guix-container.sh container-runner.touchfile | log - unshare --mount ./run-with-fake-mounts.sh \ - ./$< restart -e ./container-runner -p ./pidfile -l ./log + unshare --mount ./run-with-fake-mounts.sh $(LOGDIR) \ + ./$< restart -e ./container-runner -p ./pidfile -l $(LOGDIR) enter-container: pidfile nsenter -a -t "$$(cat pidfile)" \ -- cgit v1.2.3