summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/99-clean_install.inc
blob: 952d4fe632d7eeaa0020d6a38f418a66fa541c91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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."
}

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_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 ..."
	clean_logfiles
}