summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes
diff options
context:
space:
mode:
authorSimon Rettberg2023-10-11 15:20:55 +0200
committerSimon Rettberg2023-10-11 15:20:55 +0200
commit55b1d6b508a8cf32511b77ce6deec30c6ef1aa76 (patch)
treede99349ae64d4bb5f2da1efc827ce329a9e3f836 /satellit_installer/includes
parent[SSPS] Force-remove users >= 1000 (diff)
downloadsetup-scripts-55b1d6b508a8cf32511b77ce6deec30c6ef1aa76.tar.gz
setup-scripts-55b1d6b508a8cf32511b77ce6deec30c6ef1aa76.tar.xz
setup-scripts-55b1d6b508a8cf32511b77ce6deec30c6ef1aa76.zip
[SSPS] Cleanup cleanup, fix wrong "...failed" messages
The error checking was broken when the file to delete does not exist. Remove the exists-check entirely as it's pointless with rm -f.
Diffstat (limited to 'satellit_installer/includes')
-rw-r--r--satellit_installer/includes/99-clean_install.inc30
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
}