From 753e0297f7975f0bf8e840c8d250299467d95eab Mon Sep 17 00:00:00 2001 From: Timothy Redaelli Date: Thu, 16 Jul 2015 12:25:47 +0200 Subject: [PATCH] Try to remove immutable flag from any file before mass deletion --- vps2arch | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vps2arch b/vps2arch index 2acfc8f..09f6102 100755 --- a/vps2arch +++ b/vps2arch @@ -88,6 +88,11 @@ save_root_pass() { } delete_all() { + # Remove immutable flag from any files / directories + if command -v chattr >/dev/null 2>&1; then + find / -type f \( ! -path '/dev/*' -and ! -path '/proc/*' -and ! -path '/sys/*' -and ! -path '/selinux/*' -and ! -path "/root.$cpu_type/*" \) \ + -exec chattr -i {} + 2>/dev/null || true + fi # Delete *all* files from / find / \( ! -path '/dev/*' -and ! -path '/proc/*' -and ! -path '/sys/*' -and ! -path '/selinux/*' -and ! -path "/root.$cpu_type/*" \) -delete 2>/dev/null || true }