blob: 6ccf7537e7c18796f20ddadf2063fb41eaa2fdc8 (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/bash
set -e
set -x
export DEBIAN_FRONTEND=noninteractive
# delete interfaces ethernet eth0 address
# delete interfaces ethernet eth0 hw-id
# delete system name-server
cat <<EOF > /home/vyos/cleanup-vyos.sh
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
configure
set system host-name 'test'
commit
save
exit
EOF
chmod 0700 /home/vyos/cleanup-vyos.sh
chown vyos:users /home/vyos/cleanup-vyos.sh
su - vyos -c "/home/vyos/cleanup-vyos.sh"
# reconfiguring ssh
rm -f /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
# those packages can't be removed since they are needed for next script vyos-install.sh
# apt remove -y \
# python3-pexpect \
# expect
# cleanup apt
rm -f /etc/apt/sources.list.d/debian.list
apt -y autoremove --purge
apt-get clean
# cleanup machine-id
truncate -s 0 /etc/machine-id
# removing /tmp files
rm -rf /tmp/*
# removing log files
rm -rf /var/log/*
rm -rf /home/vyos/cleanup-vyos.sh
# removing history
export HISTFILE=0
rm -f /home/vyos/.bash_history
rm -f /root/.bash_history
# removing disk data
dd if=/dev/zero of=/EMPTY bs=1M || :
rm -f /EMPTY
sync
|