summaryrefslogtreecommitdiffstats
path: root/satellit_installer/static_files/system/usr/local/bin/finalize
blob: 1be85e23b622cac3abd99d839f7e6a2ecf35ca98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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