Make cleanup docs, mans, sources configurable
Add the var cleanup (default true) which controlls removal of docs, manpages and sources. Drop unused code in the cleanup.sh. Adjust docs. Change-Id: Idf2bbc3f2ee9660c0de69bcb9c59714ff1c26746 Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
parent
baf5019c2d
commit
e6abb3cb41
|
@ -17,6 +17,9 @@ Ubuntu build for libvrit
|
|||
HEADLESS=true \
|
||||
packer build -var 'cpus=2' -var 'memory=2048' -only=qemu ubuntu.json
|
||||
|
||||
Note, in order to preserve manpages, sources and docs to the image, define
|
||||
the ``-var 'cleanup=false'``.
|
||||
|
||||
Debian build for virtualbox
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
"headless": "{{ env `HEADLESS` }}",
|
||||
"boot_wait": "10s",
|
||||
"install_vagrant_key": "true",
|
||||
"update": "true"
|
||||
"update": "true",
|
||||
"cleanup": "true"
|
||||
},
|
||||
|
||||
"builders":
|
||||
|
@ -139,6 +140,9 @@
|
|||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"environment_vars": [
|
||||
"CLEANUP={{ user `cleanup` }}"
|
||||
],
|
||||
"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -S -E bash -x '{{.Path}}'",
|
||||
"scripts": [
|
||||
"scripts/debian/cleanup.sh",
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#!/bin/bash -euxo
|
||||
|
||||
echo "==> Installed packages before cleanup"
|
||||
dpkg --get-selections | grep -v deinstall
|
||||
|
||||
# Clean up the apt cache
|
||||
apt-get -y autoremove --purge
|
||||
#apt-get -y clean
|
||||
apt-get -y autoclean
|
||||
|
||||
echo "==> Cleaning up udev rules"
|
||||
|
@ -16,12 +12,14 @@ if [ -d "/var/lib/dhcp" ]; then
|
|||
rm /var/lib/dhcp/*
|
||||
fi
|
||||
|
||||
echo "==> Removing man pages"
|
||||
rm -rf /usr/share/man/*
|
||||
echo "==> Removing anything in /usr/src"
|
||||
rm -rf /usr/src/*
|
||||
echo "==> Removing any docs"
|
||||
rm -rf /usr/share/doc/*
|
||||
if [ "${CLEANUP}" = "true" ] ; then
|
||||
echo "==> Removing man pages"
|
||||
rm -rf /usr/share/man/*
|
||||
echo "==> Removing anything in /usr/src"
|
||||
rm -rf /usr/src/*
|
||||
echo "==> Removing any docs"
|
||||
rm -rf /usr/share/doc/*
|
||||
fi
|
||||
echo "==> Removing caches"
|
||||
find /var/cache -type f -exec rm -rf {} \;
|
||||
echo "==> Cleaning up log files"
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
"headless": "{{ env `HEADLESS` }}",
|
||||
"boot_wait": "10s",
|
||||
"install_vagrant_key": "true",
|
||||
"update": "true"
|
||||
"update": "true",
|
||||
"cleanup": "true"
|
||||
},
|
||||
|
||||
"builders":
|
||||
|
@ -146,6 +147,9 @@
|
|||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"environment_vars": [
|
||||
"CLEANUP={{ user `cleanup` }}"
|
||||
],
|
||||
"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -S -E bash -x '{{.Path}}'",
|
||||
"scripts": [
|
||||
"scripts/debian/cleanup.sh",
|
||||
|
|
Loading…
Reference in New Issue