Offer to send the log to us when an install or update fails
When update or install.sh fails and there's a terminal, ask whether to send its log to the CoreDesktop team, with the option of reading exactly what would be sent first. Nothing is sent without a yes, and nothing is asked without a terminal. The new report command sends a log later (report, report FILE) or shows what would be sent (report --view). Before sending, the log is cleaned of terminal codes, and the home folder, user name, host name, email addresses, IPv4 addresses and Tailscale names are replaced. CoreDesktop's version, the kernel's, the failed steps and sibling versions go along with it. The request format the receiver on federated.sh implements is described at the top of report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-1
@@ -27,6 +27,7 @@ cd
|
||||
if mkdir -p -m 700 "$HOME/.local/state/coredesktop/logs"; then
|
||||
INSTALL_LOG="$HOME/.local/state/coredesktop/logs/install-$(date +%Y-%m-%d-%H%M%S).log"
|
||||
exec > >(tee -a "$INSTALL_LOG") 2>&1
|
||||
TEE_PID=$!
|
||||
fi
|
||||
|
||||
# Exit on any error
|
||||
@@ -66,6 +67,17 @@ on_exit() {
|
||||
kill "$SUDO_KEEPALIVE_PID" 2> /dev/null
|
||||
if (( status != 0 )) && [ -n "$INSTALL_LOG" ]; then
|
||||
echo "The install stopped with an error. The full output is in $INSTALL_LOG"
|
||||
# Offer to send the log to us, once tee has written all of it (a second at
|
||||
# most). report asks on the terminal, so this needs one.
|
||||
local report="$HOME/.local/share/coredesktop/report" i
|
||||
if [ -f "$report" ] && { : < /dev/tty; } 2> /dev/null; then
|
||||
exec > /dev/tty 2>&1
|
||||
for (( i = 0; i < 10; i++ )); do
|
||||
kill -0 "$TEE_PID" 2> /dev/null || break
|
||||
sleep 0.1
|
||||
done
|
||||
bash "$report" --offer "$INSTALL_LOG" install.sh
|
||||
fi
|
||||
fi
|
||||
}
|
||||
trap on_exit EXIT
|
||||
@@ -91,7 +103,7 @@ cd ~/.local/share/coredesktop
|
||||
# Source utility functions (provides install_packages and other helpers)
|
||||
source utils.sh
|
||||
|
||||
# Install the refresh, update, sibling, version, configure and audit scripts to the user's bin
|
||||
# Install the refresh, update, sibling, version, configure, audit and report scripts to the user's bin
|
||||
mkdir -p ~/.local/bin
|
||||
install_script ~/.local/share/coredesktop/refresh ~/.local/bin/refresh
|
||||
install_script ~/.local/share/coredesktop/update ~/.local/bin/update
|
||||
@@ -99,6 +111,7 @@ install_script ~/.local/share/coredesktop/sibling ~/.local/bin/sibling
|
||||
install_script ~/.local/share/coredesktop/version ~/.local/bin/version
|
||||
install_script ~/.local/share/coredesktop/configure ~/.local/bin/configure
|
||||
install_script ~/.local/share/coredesktop/audit ~/.local/bin/audit
|
||||
install_script ~/.local/share/coredesktop/report ~/.local/bin/report
|
||||
|
||||
# Source the package list (defines SYSTEM_UTILS, DEV_TOOLS, DESKTOP, etc. arrays)
|
||||
if [ ! -f "packages.conf" ]; then
|
||||
|
||||
Reference in New Issue
Block a user