Add step_snap: list saved + forget per id

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-22 00:18:14 +07:00
co-authored by Claude
parent 37ce7f6ca8
commit f50579efb2
+28
View File
@@ -267,6 +267,33 @@ step_pkg_cache() {
echo "" echo ""
} }
# -----------------------------
# Bước 5: Snap — forget từng snapshot
# -----------------------------
step_snap() {
echo "${C_TITLE}--- [Snap] ---${C_RESET}"
if ! command -v snap >/dev/null 2>&1; then
echo "${C_WARN} ⚠ snap not found.${C_RESET}"
echo ""
return
fi
local saved
saved=$(sudo snap saved 2>/dev/null | awk 'NR>1{print $1}')
if [ -z "$saved" ]; then
echo "${C_OK} ✓ Không có snap snapshot nào.${C_RESET}"
echo ""
return
fi
local id
for id in $saved; do
if confirm_yn "Forget snap snapshot (Set $id)?"; then
sudo snap forget "$id"
fi
done
echo "${C_OK} ✓ Snap cleanup xong.${C_RESET}"
echo ""
}
# ----------------------------- # -----------------------------
# Chạy tuần tự 6 bước (stub — các bước thêm ở Task 4-9) # Chạy tuần tự 6 bước (stub — các bước thêm ở Task 4-9)
# ----------------------------- # -----------------------------
@@ -275,6 +302,7 @@ run_all_steps() {
step_docker step_docker
step_journal step_journal
step_pkg_cache step_pkg_cache
step_snap
} }
# ----------------------------- # -----------------------------