Skip to content

Commit

Permalink
improve minimization and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miya0001 committed Dec 9, 2016
1 parent ee3a27c commit d1689db
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
16 changes: 15 additions & 1 deletion provision/scripts/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,23 @@ apt-get -y purge ppp pppconfig pppoeconf;
# Delete oddities
apt-get -y purge popularity-contest;

aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
apt-get purge -y linux-image-3.0.0-12-generic-pae

apt-get -y autoremove;
apt-get -y clean;

rm -f VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.?;
rm -rf /usr/src/vboxguest*
rm -rf /usr/share/doc
find /var/cache -type f -exec rm -rf {} \;

rm -rf /usr/share/locale/{af,an,am,ar,ary,as,ast,az,bal,be,bg,bn,bn_IN,bo,br,bs,byn,ca,ca@valencia,ckb,cr,crh,cs,csb,cv,cy,da,de,de_AT,dv,dz,el,en_AU,en_CA,en_GB,eo,es,et,et_EE,eu,fa,fa_AF,fi,fil,fo,fr,frp,fur,fy,ga,gd,gez,gl,gu,gv,haw,he,hi,hr,ht,hu,hy,id,is,it,ja,jv,ka,kk,km,kn,ko,kok,ku,ky,lb,lg,ln,lt,lo,lv,mg,mhr,mi,mk,ml,mn,mr,ms,mt,my,nb,nds,ne,nl,nn,no,nso,oc,or,os,pa,pam,pl,ps,pt,pt_BR,qu,ro,ru,rw,sc,sd,shn,si,sk,sl,so,sq,sr,sr*latin,sv,sw,ta,te,th,ti,tig,tk,tl,tr,trv,tt,ug,uk,ur,urd,uz,ve,vec,vi,wa,wal,wo,xh,zh,zh_HK,zh_CN,zh_TW,zu}

ln -s -f /dev/null /etc/udev/rules.d/70-persistent-net.rules
unset HISTFILE
rm -f /root/.bash_history
rm -f /home/vagrant/.bash_history
find /var/log -type f | while read f; do echo -ne '' > $f; done;
5 changes: 3 additions & 2 deletions provision/scripts/minimize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

set -ex

ln -s -f /dev/null /etc/udev/rules.d/70-persistent-net.rules

dd if=/dev/zero of=/EMPTY bs=1M || echo "dd exit code $? is suppressed";
rm -f /EMPTY;
# Block until the empty file has been removed, otherwise, Packer
# will try to kill the box while the disk is still full and that's bad

sync;
35 changes: 33 additions & 2 deletions spec/default/middleware_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,37 @@
its(:stdout) { should match /ruby 2\.3\./ }
end

packages = %w{
git
build-essential
ruby-dev
libsqlite3-dev
jq
subversion
curl
gettext
python-mysqldb
imagemagick
php7.0
libapache2-mod-php7.0
php7.0-cli
php7.0-dev
php7.0-mbstring
php7.0-mcrypt
php7.0-mysql
php7.0-gd
php7.0-curl
php7.0-zip
php-xdebug
php-imagick
}

packages.each do |package|
describe package(package) do
it { should be_installed }
end
end

commands = %w{
curl
gettext
Expand All @@ -71,8 +102,8 @@
convert
}

commands.each do |commands|
describe command("which " + Shellwords.shellescape(commands)) do
commands.each do |command|
describe command("which " + Shellwords.shellescape(command)) do
let(:disable_sudo) { true }
its(:exit_status) { should eq 0 }
end
Expand Down

0 comments on commit d1689db

Please sign in to comment.