From 78a85f9b83a09109a0536e5986defe21bacbe003 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Mar 2010 09:37:24 +0100 Subject: Adding -r, --repositories option to select preconfigured third-party repositories more easily. --- Makefile | 2 +- helpers/chroot_sources | 91 ++++++++++++++++++++++ helpers/config | 14 +++- manpages/lh_config.en.1 | 4 + repositories/backports.debian-maintainers.org | 3 + repositories/backports.debian-maintainers.org.gpg | 20 +++++ repositories/live.debian.net | 3 + repositories/live.debian.net.gpg | 20 +++++ repositories/unofficial.debian-maintainers.org | 3 + repositories/unofficial.debian-maintainers.org.gpg | 20 +++++ 10 files changed, 177 insertions(+), 3 deletions(-) create mode 100644 repositories/backports.debian-maintainers.org create mode 100644 repositories/backports.debian-maintainers.org.gpg create mode 100644 repositories/live.debian.net create mode 100644 repositories/live.debian.net.gpg create mode 100644 repositories/unofficial.debian-maintainers.org create mode 100644 repositories/unofficial.debian-maintainers.org.gpg diff --git a/Makefile b/Makefile index ba22671..0c6f6ed 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ build: install: # Installing shared data mkdir -p $(DESTDIR)/usr/share/live-helper - cp -r cgi data examples live-helper.sh functions helpers hooks includes lists templates $(DESTDIR)/usr/share/live-helper + cp -r cgi data examples live-helper.sh functions helpers hooks includes lists repositories templates $(DESTDIR)/usr/share/live-helper # Installing executables mkdir -p $(DESTDIR)/usr/bin diff --git a/helpers/chroot_sources b/helpers/chroot_sources index 8e456fd..d30ac73 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 9bb9201..d1c594d 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}" diff --git a/manpages/lh_config.en.1 b/manpages/lh_config.en.1 index 9cf53c1..cbe5b63 100644 --- a/manpages/lh_config.en.1 +++ b/manpages/lh_config.en.1 @@ -160,6 +160,8 @@ lh_config \- create configuration for live\-helper .br [\fB\-\-packages\fR \fIPACKAGE\fR|\fI"PACKAGES"\fR] .br + [\fB\-r, \-\-repositories \fIREPOSITORY\fR|\fI"REPOSITORIES"\fR] +.br [\fB\-\-root-command\fR sudo] .br [\fB\-\-use-fakeroot\fR true|false] @@ -369,6 +371,8 @@ defines the format of the netboot image. Choosing tar results in a not compresse defines which lists available in /usr/share/live-helper/lists should be used. By default, this is set to standard. Note that in case you have local packages lists, you don't need to list them here. Putting them into config/chroot_local-packageslists is enough (the filename needs to have the .list suffix though). .IP "\fB\-\-packages\fR \fIPACKAGE\fR|\fI""PACKAGES""\fR" 4 defines one or more packages to be installed in the live system. This is a quick and convenient place to add a few packages when building an image (limited by the max length of shell). Packages that should be permanently installed should be put into a local packages list. +.IP "\fB\-r, \-\-repositories\fR \fIREPOSITORY\fR|\fI""REPOSITORIES""\fR" 4 +enables one of available third-party repository configurations in /usr/share/live-helper/repositories. .IP "\fB\-\-root-command\fR sudo" 4 controls if live-helper should use sudo internally to build the live image. Note that this is not well tested and that you should, when relying on sudo, call the individual live\-helper command with sudo itself. .IP "\fB\-\-use-fakeroot\fR true|false" 4 diff --git a/repositories/backports.debian-maintainers.org b/repositories/backports.debian-maintainers.org new file mode 100644 index 0000000..8ba3e02 --- /dev/null +++ b/repositories/backports.debian-maintainers.org @@ -0,0 +1,3 @@ +# Backports Maintainers +deb http://backports.debian-maintainers.org/ @DISTRIBUTION@/backports @ARCHIVE_AREAS@ +deb-src http://backports.debian-maintainers.org/ @DISTRIBUTION@/backports @ARCHIVE_AREAS@ diff --git a/repositories/backports.debian-maintainers.org.gpg b/repositories/backports.debian-maintainers.org.gpg new file mode 100644 index 0000000..7f9b836 --- /dev/null +++ b/repositories/backports.debian-maintainers.org.gpg @@ -0,0 +1,20 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.9 (GNU/Linux) + +mQENBEtljiMBCADSIplButAWL0OuM4uvDtZYjBcPlQNjwQDZ/Dpg5QuRAgNSUdx7 +wBQOQXqC4LCi9ykpvYi8FEtz0bl60M9uJdc4n+130It8gSZs7Cn0WoFk7uo0S4IS +79EQdP+yfZNv/vY11cv6TwOb7JEqB5BI7T642Y+UgQZnpT/Diykks986CYeZSfpm +6gnASAEe0jJg79Zpzpc3kBECCwN6fIFZ4MOxkaXgvfhWsOS42s6zxtQXJ65njibR +W47Klu75sxPS+5EKaS10C5+Tmv0XpV7S7s8VtRtKemMjYfLdsPmubmGcI+t/uEF7 +qT2zJLINSIIL01kpVBFpqxCmnO51XURgRqOFABEBAAG0Z2RlYmlhbi1tYWludGFp +bmVycy5vcmcgQXJjaGl2ZSBBdXRvbWF0aWMgU2lnbmluZyBLZXkgKDIwMTAwMTAx +KSA8c3lzYWRtaW5AbGlzdHMuZGViaWFuLW1haW50YWluZXJzLm9yZz6JAT4EEwEC +ACgFAktljiMCGwMFCQHihQAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJ7r +yNubnDy2BeUH/1SWIbqzIh2LkF1XK4iXyXGrzGlqtef5JX/tjaY7RC5gPVyZBP1V +jHcozn7Sum09KxaijsgP/lIVZ2tnu9niT2Waz5GPgUv79bqjGc238gEhH5zpbun/ +WF6UapiINHNYLFx0f18ImQ1gU13hLn0PYvuyN/QKmxaPlcUQtNJc3/ZtyFA0nPpB +ejiMEBxgw0H80FWSpawLKUFEStT1Y+khK0fZYVoWl0OwhJbsY/L6nBcfv27zH+5d +g7VuNpRte7AyxZEufescwWILTjIq3K2v9XHAy7sJmstfycrHQFy/33hE4yRQcOyu +bAMnNqLUp7mwqRw+KYPkAQo/DUlO//SsUKY= +=+IFy +-----END PGP PUBLIC KEY BLOCK----- diff --git a/repositories/live.debian.net b/repositories/live.debian.net new file mode 100644 index 0000000..54d1399 --- /dev/null +++ b/repositories/live.debian.net @@ -0,0 +1,3 @@ +# Debian Live Project +deb http://live.debian.net/ @DISTRIBUTION@-snapshots @ARCHIVE_AREAS@ +deb-src http://live.debian.net/ @DISTRIBUTION@-snapshots @ARCHIVE_AREAS@ diff --git a/repositories/live.debian.net.gpg b/repositories/live.debian.net.gpg new file mode 100644 index 0000000..7f9b836 --- /dev/null +++ b/repositories/live.debian.net.gpg @@ -0,0 +1,20 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.9 (GNU/Linux) + +mQENBEtljiMBCADSIplButAWL0OuM4uvDtZYjBcPlQNjwQDZ/Dpg5QuRAgNSUdx7 +wBQOQXqC4LCi9ykpvYi8FEtz0bl60M9uJdc4n+130It8gSZs7Cn0WoFk7uo0S4IS +79EQdP+yfZNv/vY11cv6TwOb7JEqB5BI7T642Y+UgQZnpT/Diykks986CYeZSfpm +6gnASAEe0jJg79Zpzpc3kBECCwN6fIFZ4MOxkaXgvfhWsOS42s6zxtQXJ65njibR +W47Klu75sxPS+5EKaS10C5+Tmv0XpV7S7s8VtRtKemMjYfLdsPmubmGcI+t/uEF7 +qT2zJLINSIIL01kpVBFpqxCmnO51XURgRqOFABEBAAG0Z2RlYmlhbi1tYWludGFp +bmVycy5vcmcgQXJjaGl2ZSBBdXRvbWF0aWMgU2lnbmluZyBLZXkgKDIwMTAwMTAx +KSA8c3lzYWRtaW5AbGlzdHMuZGViaWFuLW1haW50YWluZXJzLm9yZz6JAT4EEwEC +ACgFAktljiMCGwMFCQHihQAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJ7r +yNubnDy2BeUH/1SWIbqzIh2LkF1XK4iXyXGrzGlqtef5JX/tjaY7RC5gPVyZBP1V +jHcozn7Sum09KxaijsgP/lIVZ2tnu9niT2Waz5GPgUv79bqjGc238gEhH5zpbun/ +WF6UapiINHNYLFx0f18ImQ1gU13hLn0PYvuyN/QKmxaPlcUQtNJc3/ZtyFA0nPpB +ejiMEBxgw0H80FWSpawLKUFEStT1Y+khK0fZYVoWl0OwhJbsY/L6nBcfv27zH+5d +g7VuNpRte7AyxZEufescwWILTjIq3K2v9XHAy7sJmstfycrHQFy/33hE4yRQcOyu +bAMnNqLUp7mwqRw+KYPkAQo/DUlO//SsUKY= +=+IFy +-----END PGP PUBLIC KEY BLOCK----- diff --git a/repositories/unofficial.debian-maintainers.org b/repositories/unofficial.debian-maintainers.org new file mode 100644 index 0000000..97093c4 --- /dev/null +++ b/repositories/unofficial.debian-maintainers.org @@ -0,0 +1,3 @@ +# Unofficial Maintainers +deb http://unofficial.debian-maintainers.org/ @DISTRIBUTION@ @ARCHIVE_AREAS@ restricted +deb-src http://unofficial.debian-maintainers.org/ @DISTRIBUTION@ @ARCHIVE_AREAS@ restricted diff --git a/repositories/unofficial.debian-maintainers.org.gpg b/repositories/unofficial.debian-maintainers.org.gpg new file mode 100644 index 0000000..7f9b836 --- /dev/null +++ b/repositories/unofficial.debian-maintainers.org.gpg @@ -0,0 +1,20 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.9 (GNU/Linux) + +mQENBEtljiMBCADSIplButAWL0OuM4uvDtZYjBcPlQNjwQDZ/Dpg5QuRAgNSUdx7 +wBQOQXqC4LCi9ykpvYi8FEtz0bl60M9uJdc4n+130It8gSZs7Cn0WoFk7uo0S4IS +79EQdP+yfZNv/vY11cv6TwOb7JEqB5BI7T642Y+UgQZnpT/Diykks986CYeZSfpm +6gnASAEe0jJg79Zpzpc3kBECCwN6fIFZ4MOxkaXgvfhWsOS42s6zxtQXJ65njibR +W47Klu75sxPS+5EKaS10C5+Tmv0XpV7S7s8VtRtKemMjYfLdsPmubmGcI+t/uEF7 +qT2zJLINSIIL01kpVBFpqxCmnO51XURgRqOFABEBAAG0Z2RlYmlhbi1tYWludGFp +bmVycy5vcmcgQXJjaGl2ZSBBdXRvbWF0aWMgU2lnbmluZyBLZXkgKDIwMTAwMTAx +KSA8c3lzYWRtaW5AbGlzdHMuZGViaWFuLW1haW50YWluZXJzLm9yZz6JAT4EEwEC +ACgFAktljiMCGwMFCQHihQAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJ7r +yNubnDy2BeUH/1SWIbqzIh2LkF1XK4iXyXGrzGlqtef5JX/tjaY7RC5gPVyZBP1V +jHcozn7Sum09KxaijsgP/lIVZ2tnu9niT2Waz5GPgUv79bqjGc238gEhH5zpbun/ +WF6UapiINHNYLFx0f18ImQ1gU13hLn0PYvuyN/QKmxaPlcUQtNJc3/ZtyFA0nPpB +ejiMEBxgw0H80FWSpawLKUFEStT1Y+khK0fZYVoWl0OwhJbsY/L6nBcfv27zH+5d +g7VuNpRte7AyxZEufescwWILTjIq3K2v9XHAy7sJmstfycrHQFy/33hE4yRQcOyu +bAMnNqLUp7mwqRw+KYPkAQo/DUlO//SsUKY= +=+IFy +-----END PGP PUBLIC KEY BLOCK----- -- cgit v1.0