summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2010-03-21 09:37:24 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:17:05 +0100
commit78a85f9b83a09109a0536e5986defe21bacbe003 (patch)
tree917e49bb314d07fc83cacc171743d76cb9eeab8a /helpers
parentaf374e3c00be1313c0b3e3451ddb9d72c8442561 (diff)
downloadvyos-live-build-78a85f9b83a09109a0536e5986defe21bacbe003.tar.gz
vyos-live-build-78a85f9b83a09109a0536e5986defe21bacbe003.zip
Adding -r, --repositories option to select preconfigured third-party repositories more easily.
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/chroot_sources91
-rwxr-xr-xhelpers/config14
2 files changed, 103 insertions, 2 deletions
diff --git a/helpers/chroot_sources b/helpers/chroot_sources
index 8e456fdb0..d30ac7336 100755
--- a/helpers/chroot_sources
+++ b/helpers/chroot_sources
@@ -120,6 +120,50 @@ case "${1}" in
done
fi
+ # Configure third-party repositories
+ if [ -n "${LH_REPOSITORIES}" ]
+ then
+ for REPOSITORY in ${LH_REPOSITORIES}
+ do
+ for PLACE in config/repositories "${LH_BASE}/repositories"
+ do
+ # Prefer repositories from the config tree
+ # over the global ones.
+ if ! ls "${PLACE}/${REPOSITORY}"* > /dev/null 2>&1
+ then
+ continue
+ fi
+
+ # Adding sources.list entries (chroot)
+ if [ -e "${PLACE}/${REPOSITORY}.chroot" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LH_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LH_ARCHIVE_AREAS}|g" \
+ "${PLACE}/${REPOSITORY}.chroot" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ elif [ -e "${PLACE}/${REPOSITORY}" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LH_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LH_ARCHIVE_AREAS}|g" \
+ "${PLACE}/${REPOSITORY}" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ fi
+
+ if [ "${LH_APT_SECURE}" != false ]
+ then
+ # Adding archive signing keys (chroot)
+ if [ -e "${PLACE}/${REPOSITORY}.chroot.gpg" ]
+ then
+ cat "${PLACE}/${REPOSITORY}.chroot.gpg" | Chroot chroot "apt-key add -"
+ elif [ -e "${PLACE}/${REPOSITORY}.gpg" ]
+ then
+ cat "${PLACE}/${REPOSITORY}.gpg" | Chroot chroot "apt-key add -"
+ fi
+ fi
+ done
+ done
+ fi
+
# Configure local package repository
if Find_files config/chroot_local-packages/*.deb
then
@@ -453,6 +497,53 @@ case "${1}" in
esac
fi
+ # Configure third-party repositories
+ if [ -n "${LH_REPOSITORIES}" ]
+ then
+ for REPOSITORY in ${LH_REPOSITORIES}
+ do
+ # Removing sources.list entries (chroot)
+ rm -f "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+
+ for PLACE in config/repositories "${LH_BASE}/repositories"
+ do
+ # Prefer repositories from the config tree
+ # over the global ones.
+ if ! ls "${PLACE}/${REPOSITORY}"* > /dev/null 2>&1
+ then
+ continue
+ fi
+
+ # Adding sources.list entries (binary)
+ if [ -e "${PLACE}/${REPOSITORY}.binary" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LH_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LH_ARCHIVE_AREAS}|g" \
+ "${PLACE}/${REPOSITORY}.binary" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ elif [ -e "${PLACE}/${REPOSITORY}" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LH_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LH_ARCHIVE_AREAS}|g" \
+ "${PLACE}/${REPOSITORY}" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ fi
+
+ if [ "${LH_APT_SECURE}" != false ]
+ then
+ # Adding archive signing keys (binary)
+ if [ -e "${PLACE}/${REPOSITORY}.binary.gpg" ]
+ then
+ cat "${PLACE}/${REPOSITORY}.binary.gpg" | Chroot chroot "apt-key add -"
+ elif [ -e "${PLACE}/${REPOSITORY}.gpg" ]
+ then
+ cat "${PLACE}/${REPOSITORY}.gpg" | Chroot chroot "apt-key add -"
+ fi
+ fi
+ done
+ done
+ fi
+
# Check local sources.list
if Find_files config/chroot_sources/*.binary
then
diff --git a/helpers/config b/helpers/config
index 9bb92013a..d1c594d79 100755
--- a/helpers/config
+++ b/helpers/config
@@ -109,6 +109,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [-p|--packages-lists FILE]\n\
\t [--packages PACKAGE|\"PACKAGES\"]\n\
\t [--quiet]\n\
+\t [-r|--repositories REPOSITORY|\"REPOSITORIES\"]\n\
\t [--root-command sudo]\n\
\t [--use-fakeroot true|false]\n\
\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\
@@ -135,7 +136,7 @@ Local_arguments ()
LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-options:,aptitute-options:,
apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,
cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,dump,
- initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:,
+ initramfs:,fdisk:,losetup:,mode:,repositories:,root-command:,use-fakeroot:,tasksel:,includes:,
templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,clean,
distribution:,mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-chroot-volatile:,mirror-binary:,
mirror-binary-security:,mirror-binary-volatile:,mirror-debian-installer:,archive-areas:,chroot-filesystem:,exposed-root:,virtual-root-size:,
@@ -151,7 +152,7 @@ Local_arguments ()
help,ignore-system-defaults,quiet,usage,verbose,version"
# Remove spaces added by indentation
LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')"
- ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
+ ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:r:s:c:huv --shell sh -- "${@}")"
if [ "${?}" != "0" ]
then
@@ -330,6 +331,11 @@ Local_arguments ()
shift 2
;;
+ -r|--repositories)
+ LH_REPOSITORIES="${2}"
+ shift 2
+ ;;
+
--root-command)
LH_ROOT_COMMAND="${2}"
shift 2
@@ -1072,6 +1078,10 @@ LH_LINUX_FLAVOURS="${LH_LINUX_FLAVOURS}"
# (Default: autodetected)
LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES}"
+# \$LH_REPOSITORIES: enable available third-party repositories
+# (Default: empty)
+LH_REPOSITORIES="${LH_REPOSITORIES}"
+
# \$LH_PACKAGES: set packages to install
# (Default: empty)
LH_PACKAGES="${LH_PACKAGES}"