summaryrefslogtreecommitdiffstats
path: root/satellit_installer/static_files/system-base/usr/local/bin/finalize
diff options
context:
space:
mode:
Diffstat (limited to 'satellit_installer/static_files/system-base/usr/local/bin/finalize')
-rwxr-xr-xsatellit_installer/static_files/system-base/usr/local/bin/finalize21
1 files changed, 21 insertions, 0 deletions
diff --git a/satellit_installer/static_files/system-base/usr/local/bin/finalize b/satellit_installer/static_files/system-base/usr/local/bin/finalize
new file mode 100755
index 0000000..1be85e2
--- /dev/null
+++ b/satellit_installer/static_files/system-base/usr/local/bin/finalize
@@ -0,0 +1,21 @@
+#!/bin/dash
+
+# Funny dash has a funny 'kill' builtin, which we
+# do not want to use.
+KILL=$(which kill)
+
+EIGENEPID=$(ps -o ppid $$|fgrep -v PPID)
+
+# kill every bash in reach, but not the parent('s parent):
+for i in $(ps axo pid,comm|grep bash|cut -d " " -f 2); do
+ [ $EIGENEPID != $i ] && $KILL -SIGKILL $i 2>/dev/null
+done
+
+# Now, empty root's ~/.bash_history:
+>~/.bash_history
+
+# Now we delete the script - necessary only once.
+rm -f "$_" 2>/dev/null
+
+exit
+