1
0
mirror of https://github.com/sjlongland/gentoo-docker-builder.git synced 2025-09-13 10:03:17 +10:00

mkimg-container.sh: Include portage tree in dev, exclude in rt.

In the development image, include the full portage tree, and any binary
packages and sources.

In the runtime image, exclude the portage tree and related files.  When
installing, we will use `--volumes-from` to mount those from a
development image container.
This commit is contained in:
Stuart Longland 2017-05-21 17:45:58 +10:00
parent c7254f6d28
commit e93b002279
Signed by: stuartl
GPG Key ID: F954BBBB7948D546

View File

@ -37,15 +37,19 @@ emerge -evkuDN ${EMERGE_OPTS} @system @world
for root in ${DEVROOT} ${RTROOT}; do for root in ${DEVROOT} ${RTROOT}; do
rm -frv ${root} rm -frv ${root}
mkdir ${root} mkdir ${root}
tar -C / --exclude=usr/portage/distfiles \ tar -C / -cf - \
--exclude=usr/portage/packages \ etc/portage \
-cf - \
etc/portage var/lib/layman usr/portage \
| tar -C ${root} -xvf - | tar -C ${root} -xvf -
done done
ROOT=${DEVROOT} emerge ${EMERGE_OPTS} -eKuDN @system @world ROOT=${DEVROOT} emerge ${EMERGE_OPTS} -eKuDN @system @world
# Include the portage tree and binary packages in the development environment
# (In case they are needed later for installing in the runtime.)
tar -C / --exclude=usr/portage/distfiles \
-cf - usr/portage var/lib/layman | tar -C ${DEVROOT} -xvf -
# Bundle up the development environment
tar -C ${DEVROOT} -cvf /tmp/work/${BASENAME}-dev-${TAG}.tar . tar -C ${DEVROOT} -cvf /tmp/work/${BASENAME}-dev-${TAG}.tar .
chown -R ${OUT_UID}:${OUT_GID} /tmp/work/${BASENAME}-dev-${TAG}.tar /usr/portage/packages chown -R ${OUT_UID}:${OUT_GID} /tmp/work/${BASENAME}-dev-${TAG}.tar /usr/portage/packages
rm -fr ${DEVROOT} rm -fr ${DEVROOT}
@ -95,13 +99,15 @@ ROOT=${RTROOT} emerge ${EMERGE_OPTS} -eKuDN1 \
'sys-process/psmisc' \ 'sys-process/psmisc' \
'sys-apps/sed' \ 'sys-apps/sed' \
'sys-apps/which' \ 'sys-apps/which' \
'sys-apps/util-linux' \
'virtual/libc' \ 'virtual/libc' \
'virtual/package-manager' \ 'virtual/package-manager' \
'virtual/service-manager' \ 'virtual/service-manager' \
'sys-apps/util-linux' 'virtual/shadow'
# Clean up, because Portage ignores INSTALL_MASK sometimes. # Clean up, because Portage ignores INSTALL_MASK sometimes.
rm -frv ${RTROOT}/usr/include ${RTROOT}/usr/share/man ${RTROOT}/usr/share/info ${RTROOT}/usr/share/doc rm -frv ${RTROOT}/usr/include ${RTROOT}/usr/share/man \
${RTROOT}/usr/share/info ${RTROOT}/usr/share/doc
find ${RTROOT} -name \*.a -print -delete find ${RTROOT} -name \*.a -print -delete
find ${RTROOT} -name \*.o -print -delete find ${RTROOT} -name \*.o -print -delete
find ${RTROOT} -name \*.h -print -delete find ${RTROOT} -name \*.h -print -delete