1b74ddc0c9
gates / gates (push) Successful in 33s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
29 lines
1.7 KiB
Bash
29 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# g-update.sh <tag> — apply all pending DEBIAN updates (not Docker CE) in 9202, non-interactive, keep configs.
|
|
# Runs ON demo-hp as root. A sampler records the containers every 2 s while it runs.
|
|
export LC_ALL=C
|
|
TAG=$1
|
|
( while [ ! -f /root/g-stop-$TAG ]; do echo "$(date -u +%T) $(pct exec 9202 -- docker ps --format '{{.Names}}:{{.Status}}' 2>&1 | sort | tr '\n' ' ')"; sleep 2; done ) > /root/g-sampler-$TAG.txt 2>&1 &
|
|
SP=$!
|
|
pct exec 9202 -- bash -c '
|
|
export DEBIAN_FRONTEND=noninteractive LC_ALL=C
|
|
apt-get update -q >/dev/null 2>&1; echo update_rc=$?
|
|
pkgs=$(apt-get -s dist-upgrade | grep "^Inst " | grep -v "Docker CE" | awk "{print \$2}" | tr "\n" " ")
|
|
echo "debian_packages=$(echo $pkgs | wc -w)"
|
|
apt-get -s install --only-upgrade $pkgs 2>/dev/null | grep -E "^(Need to get|After this operation|[0-9]+ upgraded)"
|
|
df -B1 --output=used / | tail -1 | sed "s/^/rootfs_used_before /"
|
|
du -sb /var/cache/apt/archives | sed "s/^/apt_cache_before /"
|
|
s=$(date +%s.%N)
|
|
apt-get install -y -q --only-upgrade -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef $pkgs > /root/apt-run.log 2>&1
|
|
rc=$?
|
|
echo "apt_rc=$rc seconds=$(awk -v a=$s -v b=$(date +%s.%N) "BEGIN{printf \"%.1f\", b-a}")"
|
|
grep -E "^(Fetched|Need to get)" /root/apt-run.log
|
|
grep -iE "conffile|Configuration file|dpkg-old|dpkg-dist|warning" /root/apt-run.log | head -8
|
|
du -sb /var/cache/apt/archives | sed "s/^/apt_cache_after /"
|
|
df -B1 --output=used / | tail -1 | sed "s/^/rootfs_used_after /"
|
|
apt-get clean; df -B1 --output=used / | tail -1 | sed "s/^/rootfs_used_after_clean /"
|
|
echo "pending_debian_after=$(apt-get -s dist-upgrade | grep "^Inst " | grep -vc "Docker CE")"
|
|
grep -E "^Restarting|restart" /root/apt-run.log | head -10
|
|
'
|
|
touch /root/g-stop-$TAG; wait $SP
|