diff options
-rw-r--r-- | satellit_installer/includes/99-clean_install.inc | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/satellit_installer/includes/99-clean_install.inc b/satellit_installer/includes/99-clean_install.inc index 952d4fe..84bf85b 100644 --- a/satellit_installer/includes/99-clean_install.inc +++ b/satellit_installer/includes/99-clean_install.inc @@ -1,34 +1,20 @@ # Functions for cleaning some stuff after script run clean_logfiles() { - # delete only files, not directories - find /var/log -type f -delete - ERR=$? - [ $ERR -eq 0 ] && echo " ok." || echo " error cleaning log files." + echo "# cleaning log files ..." + find /var/log -type f -delete \ + || pwarning " error cleaning log files." } -clean_authorized_hosts() { - [ -f /root/.ssh/authorized_keys ] && rm -f /root/.ssh/authorized_keys - ERR=$? - [ $ERR -eq 0 ] && echo " ok." || echo " error cleaning authorized keys file." -} -clean_idrsa() { - [ -f /root/.ssh/id_rsa ] && rm -f /root/.ssh/id_rsa # rsa will suffice for our git keys - ERR=$? - [ $ERR -eq 0 ] && echo " ok." || echo " error cleaning id_rsa identity file." +clean_root_ssh() { + echo "# wiping root's .ssh dir ..." + rm -rf -- /root/.ssh || pwarning "Error wiping root's .ssh dir" } clean_install() { GESERR=0 - echo "#" - echo "# Now, let's clean some unnecessary or harmful entries, e.g. " - echo "# entries in authorized_hosts, .bash_history and files beneath /var/log." - echo "#" - echo -n "# cleaning authorized_hosts ..." - clean_authorized_hosts - echo -n "# cleaning id_rsa private key ..." - clean_idrsa - echo -n "# cleaning log files ..." + echo "# Cleanup" + clean_root_ssh clean_logfiles } |