From 4b8ccfbf3476b7c49f72b6b67c469f5ee5c43893 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Feb 2023 16:22:32 -0500 Subject: [PATCH] fix: implement checkTMP --- .../images/digitalocean/in_parts/100-image-check | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/images/digitalocean/in_parts/100-image-check b/contrib/images/digitalocean/in_parts/100-image-check index bd7178132..a14bb87c1 100755 --- a/contrib/images/digitalocean/in_parts/100-image-check +++ b/contrib/images/digitalocean/in_parts/100-image-check @@ -136,7 +136,15 @@ function checkLogs { } function checkTMP { # Check the /tmp directory to ensure it is empty. Warn on any files found. - return 1 + if [[ -n "$(ls -A /tmp)" ]]; then + echo -en "\e[93m[WARN]\e[0m /tmp directory is not empty; Contents\n" + ls -A /tmp + ((WARN++)) + return 1 + fi + + echo -en "\e[32m[PASS]\e[0m /tmp directory is empty\n" + return 0 } function checkRoot { user="root" @@ -595,6 +603,9 @@ checkUsers echo -en "\n\nChecking the root account...\n" checkRoot +echo -en "\n\nChecking the /tmp directory...\n" +checkTMP + checkAgent # Summary