Merge "Optionally remove portage files"

This commit is contained in:
Jenkins 2016-08-04 05:20:54 +00:00 committed by Gerrit Code Review
commit 46ce2ac527
5 changed files with 10 additions and 4 deletions

View file

@ -30,3 +30,7 @@ Notes:
default/linux/amd64/13.0/no-multilib
hardened/linux/amd64
hardened/linux/amd64/no-multilib
* You can set the GENTOO_PORTAGE_CLEANUP environment variable to true (or
anything other than False) to clean up portage from the system and get the
image size smaller.

View file

@ -1,2 +1,3 @@
export DISTRO_NAME=gentoo
export GENTOO_PROFILE=${GENTOO_PROFILE:-'default/linux/amd64/13.0'}
export GENTOO_PORTAGE_CLEANUP=${GENTOO_PORTAGE_CLEANUP:-'False'}

View file

@ -23,8 +23,11 @@ shopt -s extglob
rm -Rf /tmp/!(ccache|in_target*|profiledir*)
shopt -u extglob
rm -Rf /root/.ccache/* /usr/portage/* /usr/src/* /var/cache/edb/dep/* /var/cache/genkernel/* /var/empty/* /var/run/* /var/state/* /var/tmp/* /var/cache/portage/distfiles
rm -Rf /root/.ccache/* /usr/src/* /var/cache/edb/dep/* /var/cache/genkernel/* /var/empty/* /var/run/* /var/state/* /var/tmp/*
rm -Rf /etc/*- /etc/*.old /etc/ssh/ssh_host_* /root/.*history /root/.lesshst /root/.ssh/known_hosts /root/.viminfo /usr/share/genkernel /usr/lib64/python*/site-packages/gentoolkit/test/eclean/testdistfiles.tar.gz
if [[ "${GENTOO_PORTAGE_CLEANUP}" != "False" ]]; then
rm -Rf /usr/portage/* /var/cache/portage/distfiles
fi
# shrink a bit
for i in $(find /var/log -type f); do echo > $i; done

View file

@ -33,8 +33,6 @@ if ! [ 'x86_64' = "${ARCH}" ] ; then
exit 1
fi
# get the element location so we can refrence things relative to it
ELEMENT_DIR=${ELEMENT_DIR:-"${ELEMENTS_PATH##*:}/gentoo"}
# valid gentoo profiles are as follows
# default/linux/amd64/13.0
# default/linux/amd64/13.0/no-multilib
@ -81,7 +79,7 @@ else
# https://dev.gentoo.org/~dolsen/releases/keyrings/gentoo-keys-*.tar.xz
# http://distfiles.gentoo.org/distfiles/gentoo-keys-*.tar.xz
GPGDIR=$(mktemp -d -t)
gpg --no-default-keyring --keyring "${GPGDIR}"/gentookeys.gpg --import "${ELEMENT_DIR}"/gentoo-releng.gpg
gpg --no-default-keyring --keyring "${GPGDIR}"/gentookeys.gpg --import "${TMP_HOOKS_PATH}"/extra-data.d/gentoo-releng.gpg
# check the sig file
gpgv --keyring "${GPGDIR}"/gentookeys.gpg "${CACHED_SIGNATURE_FILE}"
if [[ "${?}" != 0 ]]; then