mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7143: cleanup zerodisk.sh code
This commit is contained in:
parent
f67a379a46
commit
44ceeabb28
|
|
@ -1,15 +1,27 @@
|
|||
# Clean up stuff copied in by veewee
|
||||
rm -fv /root/*.iso
|
||||
rm -fv /root/base.sh /root/cleanup.sh /root/postinstall.sh /root/zerodisk.sh
|
||||
rm -fv .veewee_version .veewee_params .vbox_version
|
||||
#!/bin/bash
|
||||
|
||||
echo "Cleaning up"
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# clean up stuff copied in by veewee
|
||||
function cleanup_veewee() {
|
||||
# this has to be here since it is the last file to run (and we remove ourselves)
|
||||
rm -fv /root/*.iso
|
||||
rm -fv /root/{apt_upgrade,build_time,cleanup,install_systemvm_packages,zerodisk}.sh
|
||||
rm -fv /root/configure_{acpid,conntrack,grub,locale,login,networking,systemvm_services}.sh
|
||||
rm -fv .veewee_version .veewee_params .vbox_version
|
||||
}
|
||||
|
||||
# Zero out the free space to save space in the final image:
|
||||
for path in / /boot /usr /var /opt /tmp /home
|
||||
do
|
||||
dd if=/dev/zero of=$path/zero bs=1M
|
||||
sync
|
||||
rm -f $path/zero
|
||||
echo "Completed zero-ing out disk on $path"
|
||||
done
|
||||
function zero_disk() {
|
||||
cleanup_veewee
|
||||
|
||||
for path in / /boot /usr /var /opt /tmp /home
|
||||
do
|
||||
dd if=/dev/zero of=${path}/zero bs=1M || true
|
||||
sync
|
||||
rm -f ${path}/zero
|
||||
done
|
||||
}
|
||||
|
||||
return 2>/dev/null || zero_disk
|
||||
|
|
|
|||
Loading…
Reference in New Issue