Optionally remove portage files

Optionally remove portage files, so that we can cache package and
keep the portage directory around, specifically for nodepool.

This also adds a section to the Gentoo readme about the variable
and renames the 00-gentoo-distro-name environment file to a more
appropriate name of 00-gentoo-envars.

Also brought up was the location of the gentoo-releng.gpg file,
this has been moved and the refrencing paths updated.

Change-Id: I20c91b36082828faa1ca481585acc5f9933211e1
This commit is contained in:
Matthew Thode 2016-07-28 15:11:43 -05:00
parent ed116d60a9
commit ffb8efda74
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
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