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 \
|
HEADLESS=true \
|
||||||
packer build -var 'cpus=2' -var 'memory=2048' -only=qemu ubuntu.json
|
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
|
Debian build for virtualbox
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
"headless": "{{ env `HEADLESS` }}",
|
"headless": "{{ env `HEADLESS` }}",
|
||||||
"boot_wait": "10s",
|
"boot_wait": "10s",
|
||||||
"install_vagrant_key": "true",
|
"install_vagrant_key": "true",
|
||||||
"update": "true"
|
"update": "true",
|
||||||
|
"cleanup": "true"
|
||||||
},
|
},
|
||||||
|
|
||||||
"builders":
|
"builders":
|
||||||
|
@ -139,6 +140,9 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
"environment_vars": [
|
||||||
|
"CLEANUP={{ user `cleanup` }}"
|
||||||
|
],
|
||||||
"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -S -E bash -x '{{.Path}}'",
|
"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -S -E bash -x '{{.Path}}'",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"scripts/debian/cleanup.sh",
|
"scripts/debian/cleanup.sh",
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
#!/bin/bash -euxo
|
#!/bin/bash -euxo
|
||||||
|
|
||||||
echo "==> Installed packages before cleanup"
|
|
||||||
dpkg --get-selections | grep -v deinstall
|
|
||||||
|
|
||||||
# Clean up the apt cache
|
# Clean up the apt cache
|
||||||
apt-get -y autoremove --purge
|
apt-get -y autoremove --purge
|
||||||
#apt-get -y clean
|
|
||||||
apt-get -y autoclean
|
apt-get -y autoclean
|
||||||
|
|
||||||
echo "==> Cleaning up udev rules"
|
echo "==> Cleaning up udev rules"
|
||||||
|
@ -16,12 +12,14 @@ if [ -d "/var/lib/dhcp" ]; then
|
||||||
rm /var/lib/dhcp/*
|
rm /var/lib/dhcp/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Removing man pages"
|
if [ "${CLEANUP}" = "true" ] ; then
|
||||||
rm -rf /usr/share/man/*
|
echo "==> Removing man pages"
|
||||||
echo "==> Removing anything in /usr/src"
|
rm -rf /usr/share/man/*
|
||||||
rm -rf /usr/src/*
|
echo "==> Removing anything in /usr/src"
|
||||||
echo "==> Removing any docs"
|
rm -rf /usr/src/*
|
||||||
rm -rf /usr/share/doc/*
|
echo "==> Removing any docs"
|
||||||
|
rm -rf /usr/share/doc/*
|
||||||
|
fi
|
||||||
echo "==> Removing caches"
|
echo "==> Removing caches"
|
||||||
find /var/cache -type f -exec rm -rf {} \;
|
find /var/cache -type f -exec rm -rf {} \;
|
||||||
echo "==> Cleaning up log files"
|
echo "==> Cleaning up log files"
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
"headless": "{{ env `HEADLESS` }}",
|
"headless": "{{ env `HEADLESS` }}",
|
||||||
"boot_wait": "10s",
|
"boot_wait": "10s",
|
||||||
"install_vagrant_key": "true",
|
"install_vagrant_key": "true",
|
||||||
"update": "true"
|
"update": "true",
|
||||||
|
"cleanup": "true"
|
||||||
},
|
},
|
||||||
|
|
||||||
"builders":
|
"builders":
|
||||||
|
@ -146,6 +147,9 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
"environment_vars": [
|
||||||
|
"CLEANUP={{ user `cleanup` }}"
|
||||||
|
],
|
||||||
"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -S -E bash -x '{{.Path}}'",
|
"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -S -E bash -x '{{.Path}}'",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"scripts/debian/cleanup.sh",
|
"scripts/debian/cleanup.sh",
|
||||||
|
|
Loading…
Reference in New Issue