forked from p4lang/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean.sh
executable file
·50 lines (37 loc) · 1014 Bytes
/
clean.sh
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
#! /bin/bash
# To reduce disk space used by the virtual machine, delete many build
# files created during execution of root-bootstrap.sh and
# user-bootstrap.sh scripts.
# This script is _not_ automatically run during creation of the VM, so
# that if anything goes wrong during the build, all of the resulting
# files are left behind for examination.
DF1_BEFORE=`df -h .`
DF2_BEFORE=`df -BM .`
cd protobuf
make clean
cd ..
cd grpc
make clean
cd ..
cd behavioral-model
make clean
cd ..
cd p4c
/bin/rm -fr build
cd ..
/bin/rm usr-local-*.txt pip3-list-2b-*.txt
sudo apt autoremove
sudo apt clean
# Zero out unused disk blocks. Results in significantly smaller VM
# image files.
echo "Writing zeros to unused disk blocks (be patient) ..."
FNAME=`mktemp --tmpdir big-empty-zero-file-XXXXXXXX`
dd if=/dev/zero of=${FNAME} bs=4096k
/bin/rm -f ${FNAME}
echo "Disk usage before running this script:"
echo "$DF1_BEFORE"
echo "$DF2_BEFORE"
echo ""
echo "Disk usage after running this script:"
df -h .
df -BM .