Skip to content

Commit

Permalink
Merge pull request boxcutter#48 from Koalephant/make-doc-removal-conf…
Browse files Browse the repository at this point in the history
…igurable

Make doc removal configurable
  • Loading branch information
misheska authored Sep 13, 2017
2 parents 49f7c97 + 2b4bb49 commit e6e2b17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions debian.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
{
"environment_vars": [
"DESKTOP={{user `desktop`}}",
"REMOVE_DOCS={{user `remove_docs`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
"SSH_USERNAME={{user `ssh_username`}}",
Expand Down Expand Up @@ -179,6 +180,7 @@
"parallels_guest_os_type": "debian",
"preseed": "preseed-jessie.cfg",
"rsync_proxy": "{{env `rsync_proxy`}}",
"remove_docs": "true",
"ssh_password": "vagrant",
"ssh_username": "vagrant",
"update": "false",
Expand Down
26 changes: 18 additions & 8 deletions script/minimize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ echo "==> Removing linux source"
dpkg --list | awk '{ print $2 }' | grep linux-source | xargs apt-get -y purge
echo "==> Removing development packages"
dpkg --list | awk '{ print $2 }' | grep -- '-dev$' | xargs apt-get -y purge
echo "==> Removing documentation"
dpkg --list | awk '{ print $2 }' | grep -- '-doc$' | xargs apt-get -y purge

if [[ "$REMOVE_DOCS" =~ ^(true|yes|on|1|TRUE|YES|ON])$ ]]; then
echo "==> Removing documentation"
dpkg --list | awk '{ print $2 }' | grep -- '-doc$' | xargs apt-get -y purge
fi

apt-get -y purge build-essential
echo "==> Removing X11 libraries"
apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6
Expand All @@ -43,16 +47,22 @@ apt-get -y autoremove --purge
apt-get -y autoclean
apt-get -y clean

echo "==> Removing man pages"
find /usr/share/man -type f -delete
echo "==> Removing APT files"
find /var/lib/apt -type f -delete
echo "==> Removing any docs"
find /usr/share/doc -type f -delete

if [[ "$REMOVE_DOCS" =~ ^(true|yes|on|1|TRUE|YES|ON])$ ]]; then
echo "==> Removing man pages"
find /usr/share/man -type f -delete
echo "==> Removing any docs"
find /usr/share/doc -type f -delete
echo "==> Removing info"
rm -rf /usr/share/info/*
fi

echo "==> Removing caches"
find /var/cache -type f -delete
echo "==> Removing groff info lintian linda"
rm -rf /usr/share/groff/* /usr/share/info/* /usr/share/lintian/* /usr/share/linda/*
echo "==> Removing lintian linda"
rm -rf /usr/share/lintian/* /usr/share/linda/*

echo "==> Disk usage after cleanup"
df -h

0 comments on commit e6e2b17

Please sign in to comment.