blancco-init: auto-save reports to the SMB share in process=auto
process=auto erases unattended but Albus forces auto_backup off outside
workflow/manual, so every report needed a manual Save to reach the
share. Debug SSH on a live 7.20 run showed Albus does keep each report
at /reports/<document_id>.xml ("Report saving success", "CRC verified")
and uploads it to MC, with /mnt/share already mounted.
Install blancco-report-sync as a systemd service in the new root: every
10s copy each finished /reports/*.xml (older than 5s, not yet copied)
to /mnt/share as YYYYMMDD_HHMMSS_report.xml (UTC, as a manual Save
names it), via a .part file and rename. Verified live: the auto-run
report landed as 20261005_164520_report.xml.
This commit is contained in:
@@ -271,6 +271,59 @@ XEOF
|
|||||||
chmod +x /run/newroot/etc/X11/xinit/xinitrc.d/00-no-screen-blank.sh
|
chmod +x /run/newroot/etc/X11/xinit/xinitrc.d/00-no-screen-blank.sh
|
||||||
|
|
||||||
mkdir -p /run/newroot/proc /run/newroot/sys /run/newroot/dev /run/newroot/run /run/newroot/tmp
|
mkdir -p /run/newroot/proc /run/newroot/sys /run/newroot/dev /run/newroot/run /run/newroot/tmp
|
||||||
|
# Auto-save reports to the SMB share. process=auto never writes the share
|
||||||
|
# (Albus forces auto_backup off outside workflow/manual) but does keep each
|
||||||
|
# report in /reports; a small service copies them across.
|
||||||
|
mkdir -p /run/newroot/usr/local/sbin /run/newroot/etc/systemd/system/multi-user.target.wants
|
||||||
|
cat > /run/newroot/usr/local/sbin/blancco-report-sync << 'XEOF'
|
||||||
|
#!/bin/bash
|
||||||
|
# Copy Blancco reports to the SMB report share.
|
||||||
|
#
|
||||||
|
# In process=auto Albus saves each report to /reports/<document_id>.xml and
|
||||||
|
# uploads it to the cloud, but never writes the share: auto_backup is
|
||||||
|
# forced off outside workflow/manual mode. Albus has the share mounted at
|
||||||
|
# /mnt/share already, so copy each finished report there, named the way a
|
||||||
|
# manual Save names it (UTC YYYYMMDD_HHMMSS_report.xml).
|
||||||
|
# Usage: blancco-report-sync [--once]
|
||||||
|
DONE=/var/lib/blancco-report-sync
|
||||||
|
mkdir -p "$DONE"
|
||||||
|
while :; do
|
||||||
|
for f in /reports/*.xml; do
|
||||||
|
[ -s "$f" ] || continue
|
||||||
|
id=$(basename "$f" .xml)
|
||||||
|
[ -e "$DONE/$id" ] && continue
|
||||||
|
# Leave files Albus may still be writing.
|
||||||
|
[ $(( $(date +%s) - $(stat -c %Y "$f") )) -ge 5 ] || continue
|
||||||
|
mountpoint -q /mnt/share || continue
|
||||||
|
name="$(date -u -r "$f" +%Y%m%d_%H%M%S)_report.xml"
|
||||||
|
if cp "$f" "/mnt/share/$name.part" && mv -f "/mnt/share/$name.part" "/mnt/share/$name"; then
|
||||||
|
touch "$DONE/$id"
|
||||||
|
echo "copied $id to $name"
|
||||||
|
else
|
||||||
|
rm -f "/mnt/share/$name.part"
|
||||||
|
echo "copy of $id failed, will retry"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ "$1" = "--once" ] && exit 0
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
XEOF
|
||||||
|
chmod 755 /run/newroot/usr/local/sbin/blancco-report-sync
|
||||||
|
cat > /run/newroot/etc/systemd/system/blancco-report-sync.service << 'XEOF'
|
||||||
|
[Unit]
|
||||||
|
Description=Copy Blancco reports to the SMB report share
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/local/sbin/blancco-report-sync
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
XEOF
|
||||||
|
ln -sf /etc/systemd/system/blancco-report-sync.service \
|
||||||
|
/run/newroot/etc/systemd/system/multi-user.target.wants/blancco-report-sync.service
|
||||||
|
|
||||||
# Debug boots only: Blancco's own debug mode (/etc/debug.environment makes
|
# Debug boots only: Blancco's own debug mode (/etc/debug.environment makes
|
||||||
# isDebugMode true, so 2_sshd starts sshd) plus an SSH key for root.
|
# isDebugMode true, so 2_sshd starts sshd) plus an SSH key for root.
|
||||||
# Root is locked and sshd is key-only, so without the key there is no way
|
# Root is locked and sshd is key-only, so without the key there is no way
|
||||||
|
|||||||
Reference in New Issue
Block a user