]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: use cp for journal copying when systemd-journal-remote non-existent
authorwangyuhang <wangyuhang27@huawei.com>
Sun, 24 Apr 2022 07:31:33 +0000 (15:31 +0800)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Apr 2022 08:27:17 +0000 (08:27 +0000)
test/test-functions

index 7155e99c0e779bbd3c813f211046b11691e9211c..374821052727597b3cf2f00c9b2fbd3b06f81919 100644 (file)
@@ -94,7 +94,7 @@ fi
 
 PATH_TO_INIT="$ROOTLIBDIR/systemd"
 SYSTEMD_JOURNALD="${SYSTEMD_JOURNALD:-$(command -v "$BUILD_DIR/systemd-journald" || command -v "$ROOTLIBDIR/systemd-journald")}"
-SYSTEMD_JOURNAL_REMOTE="${SYSTEMD_JOURNAL_REMOTE:-$(command -v "$BUILD_DIR/systemd-journal-remote" || command -v "$ROOTLIBDIR/systemd-journal-remote")}"
+SYSTEMD_JOURNAL_REMOTE="${SYSTEMD_JOURNAL_REMOTE:-$(command -v "$BUILD_DIR/systemd-journal-remote" || command -v "$ROOTLIBDIR/systemd-journal-remote" || echo "")}"
 SYSTEMD="${SYSTEMD:-$(command -v "$BUILD_DIR/systemd" || command -v "$ROOTLIBDIR/systemd")}"
 SYSTEMD_NSPAWN="${SYSTEMD_NSPAWN:-$(command -v "$BUILD_DIR/systemd-nspawn" || command -v systemd-nspawn)}"
 JOURNALCTL="${JOURNALCTL:-$(command -v "$BUILD_DIR/journalctl" || command -v journalctl)}"
@@ -1456,7 +1456,11 @@ save_journal() {
 
     for j in "${1:?}"/*; do
         if get_bool "$save"; then
-            "$SYSTEMD_JOURNAL_REMOTE" -o "$dest" --getter="$JOURNALCTL -o export -D $j"
+            if [ "$SYSTEMD_JOURNAL_REMOTE" = "" ]; then
+                cp -a "$j" "$dest"
+            else
+                "$SYSTEMD_JOURNAL_REMOTE" -o "$dest" --getter="$JOURNALCTL -o export -D $j"
+            fi
         fi
 
         if [ -n "${TEST_SHOW_JOURNAL}" ]; then