Last active
November 10, 2016 11:20
-
-
Save ichadhr/2b3fa77b5f9e56740003e539e4e53084 to your computer and use it in GitHub Desktop.
Vagrant Box CleanUp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Make user as root" | |
sudo -s -- <<EOF | |
echo "Clean system cache.." | |
apt-get clean | |
apt-get autoclean | |
apt-get autoremove | |
echo "Reducing final box" | |
dd if=/dev/zero of=/EMPTY bs=1M | |
rm -f /EMPTY | |
find /var/cache -type f -exec rm -rf {} \; | |
rm -f ~/.zsh_history | |
echo "Done. Switch to normal user" | |
EOF | |
echo "Get public keys" | |
wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys | |
echo "Shutdown VM.." | |
sudo -s -- <<EOF | |
rm /home/vagrant/.zsh_history | |
shutdown -h now | |
EOF | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment