Skip to content

Commit 7d420d6

Browse files
committed
also put logs into kexec directory
1 parent 086921a commit 7d420d6

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/nixos-anywhere.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,6 @@ importFacts() {
593593
done
594594
set -u
595595

596-
# Compute the log file path from the home directory
597-
remoteLogFile="${remoteHomeDir}/.nixos-anywhere.log"
598-
599596
if [[ -n ${enableDebug} ]]; then
600597
set -x
601598
fi
@@ -722,10 +719,6 @@ runKexec() {
722719
kexecUrl=${kexecUrl/"github.com"/"gh-v6.com"}
723720
fi
724721
725-
if [[ -z $remoteLogFile ]]; then
726-
abort "Could not create a temporary log file for $sshUser"
727-
fi
728-
729722
# Handle kexec operation failures
730723
handleKexecFailure() {
731724
local operation=$1
@@ -734,7 +727,7 @@ runKexec() {
734727
local logContent=""
735728
if logContent=$(
736729
set +x
737-
runSsh "cat \"$remoteLogFile\" 2>/dev/null" 2>/dev/null
730+
runSsh "cat \"$remoteHomeDir/kexec/nixos-anywhere.log\" 2>/dev/null" 2>/dev/null
738731
); then
739732
echo "Remote output log:" >&2
740733
echo "$logContent" >&2
@@ -761,10 +754,10 @@ runKexec() {
761754
# Execute tar command
762755
%TAR_COMMAND%
763756
TMPDIR=\"$remoteHomeDir/kexec\" ${maybeSudo} setsid --wait \"$remoteHomeDir/kexec/kexec/run\" --kexec-extra-flags $(printf '%q' "$kexecExtraFlags")
764-
} 2>&1 | tee \"$remoteLogFile\" || true
757+
} 2>&1 | tee \"$remoteHomeDir/kexec/nixos-anywhere.log\" || true
765758
766759
# The script will likely disconnect us, so we consider it successful if we see the kexec message
767-
if ! grep -q 'machine will boot into nixos' \"$remoteLogFile\"; then
760+
if ! grep -q 'machine will boot into nixos' \"$remoteHomeDir/kexec/nixos-anywhere.log\"; then
768761
echo 'Kexec may have failed - check output above'
769762
exit 1
770763
fi

0 commit comments

Comments
 (0)