summaryrefslogtreecommitdiff
path: root/scripts/build/chroot_archives
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 14:48:46 +0200
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 14:48:46 +0200
commitd1047e809a90daa0e88329efc0db21931be0b919 (patch)
tree5dc92aaaeb4d15dcad4796935b90a9675be93ad5 /scripts/build/chroot_archives
parent160d6bade79bf58a1c0d1842dc9b55ec178ec303 (diff)
downloadvyos-live-build-d1047e809a90daa0e88329efc0db21931be0b919.tar.gz
vyos-live-build-d1047e809a90daa0e88329efc0db21931be0b919.zip
Adding debian version 4.0~a1-1.debian/4.0_a1-1
Diffstat (limited to 'scripts/build/chroot_archives')
-rwxr-xr-xscripts/build/chroot_archives324
1 files changed, 164 insertions, 160 deletions
diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives
index 6e464ec4d..3785b65ba 100755
--- a/scripts/build/chroot_archives
+++ b/scripts/build/chroot_archives
@@ -1,7 +1,7 @@
#!/bin/sh
## live-build(7) - System Build Scripts
-## Copyright (C) 2006-2013 Daniel Baumann <daniel@debian.org>
+## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
@@ -131,7 +131,7 @@ EOF
fi
;;
- ubuntu)
+ ubuntu|kubuntu)
echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
@@ -196,7 +196,7 @@ EOF
do
# ubuntu workaround to allow using live.debian.net
case "${LB_MODE}" in
- ubuntu)
+ ubuntu|kubuntu)
if [ "${REPOSITORY}" = "live.debian.net" ]
then
_DISTRIBUTION="sid"
@@ -217,86 +217,83 @@ EOF
continue
fi
- # Adding apt sources (chroot)
- for _FILE in "${_BASE}/archives/${REPOSITORY}" "${_BASE}/archives/${REPOSITORY}.chroot"
- do
- if [ -e "${_FILE}" ]
- then
- sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
- -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
- -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
- "${_FILE}" > "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
- fi
- done
+ # Adding sources.list entries (chroot)
+ if [ -e "${_BASE}/archives/${REPOSITORY}.chroot" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
+ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
+ "${_BASE}/archives/${REPOSITORY}.chroot" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ elif [ -e "${_BASE}/archives/${REPOSITORY}" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
+ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
+ "${_BASE}/archives/${REPOSITORY}" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ fi
- # Adding apt configuration (chroot)
- for _FILE in "${_BASE}/archives/${REPOSITORY}.conf" "${_BASE}/archives/${REPOSITORY}.conf.chroot"
- do
- if [ -e "${_FILE}" ]
- then
- cp "${_FILE}" "chroot/etc/apt/conf.d/${REPOSITORY}.conf"
- fi
- done
+ # Adding pinning preferences (chroot)
+ if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ]
+ then
+ cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d
+ elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.chroot" ]
+ then
+ cp "${_BASE}/archives/${REPOSITORY}.pref.chroot" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref"
+ fi
- # Adding apt preferences (chroot)
- for _FILE in "${_BASE}/archives/${REPOSITORY}.pref" "${_BASE}/archives/${REPOSITORY}.pref.chroot"
- do
- if [ -e "${_FILE}" ]
+ if [ "${LB_APT_SECURE}" != false ]
+ then
+ # Adding archive signing keys (chroot)
+ if [ -e "${_BASE}/archives/${REPOSITORY}.key.chroot" ]
+ then
+ cat "${_BASE}/archives/${REPOSITORY}.key.chroot" | Chroot chroot "apt-key add -"
+ elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ]
then
- cp "${_FILE}" "chroot/etc/apt/preferences.d/${REPOSITORY}.pref"
+ cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
fi
- done
+ fi
+ done
+ fi
- # Adding apt keys (chroot)
- if [ "${LB_APT_SECURE}" != false ]
+ # Check local sources.list
+ if Find_files config/archives/*.list || \
+ Find_files config/archives/*.list.chroot
+ then
+ for FILE in config/archives/*.list \
+ config/archives/*.list.chroot
+ do
+ if [ -e "${FILE}" ]
then
- for _FILE in "${_BASE}/archives/${REPOSITORY}.key" "${_BASE}/archives/${REPOSITORY}.key.chroot"
- do
- if [ -e "${_FILE}" ]
- then
- cat "${_FILE}" | Chroot chroot "apt-key add -"
- fi
- done
+ sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
+ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
+ -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
+ "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
+
+ if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
+ then
+ # Strip out source archives
+ sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
+ fi
fi
done
fi
- # Adding local apt sources (chroot)
- for FILE in config/archives/*.list config/archives/*.list.chroot
- do
- if [ -e "${FILE}" ]
- then
- sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
- -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
- -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
- -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
- "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
-
- if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
+ # Check local pinning preferences
+ if Find_files config/archives/*.pref || \
+ Find_files config/archives/*.pref.chroot
+ then
+ for FILE in config/archives/*.pref \
+ config/archives/*.pref.chroot
+ do
+ if [ -e "${FILE}" ]
then
- # Strip out source archives
- sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
+ cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
fi
- fi
- done
-
- # Adding local apt configuration (chroot)
- for FILE in config/archives/*.conf config/archives/*.conf.chroot
- do
- if [ -e "${FILE}" ]
- then
- cp ${FILE} chroot/etc/apt/conf.d/$(basename ${FILE} .chroot)
- fi
- done
-
- # Adding local apt preferences (chroot)
- for FILE in config/archives/*.pref config/archives/*.pref.chroot
- do
- if [ -e "${FILE}" ]
- then
- cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
- fi
- done
+ done
+ fi
# Configure local package repository
if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb
@@ -366,12 +363,13 @@ EOF
if [ "${LB_APT_SECURE}" = "true" ]
then
- if [ -e chroot/root/.gnupg ]
+ _LB_DOTGNUPG_EXISTED=0
+ if [ -d chroot/root/.gnupg ]
then
- mv chroot/root/.gnupg chroot/root/.gnupg.orig
+ _LB_DOTGNUPG_EXISTED=1
fi
- # Ensure ~/.gnupg exists
+ # Ensure ~/.gnupg exists (required for gnupg >= ~1.4.9)
mkdir -p chroot/root/.gnupg
# Temporarily replace /dev/random with /dev/urandom so as not
@@ -435,11 +433,10 @@ EOF
mv chroot/dev/random.orig chroot/dev/random
fi
- rm -rf chroot/root/.gnupg
-
- if [ -e chroot/root/.gnupg.orig ]
+ # Remove /root/.gnupg if we created it during the signing process
+ if [ "${_LB_DOTGNUPG_EXISTED}" -eq 0 ]
then
- mv chroot/root/.gnupg.orig chroot/root/.gnupg
+ rm -rf chroot/root/.gnupg
fi
fi
@@ -554,7 +551,13 @@ EOF
# Installing keyring packages
if [ -n "${LB_KEYRING_PACKAGES}" ]
then
- Apt chroot "install ${LB_KEYRING_PACKAGES}"
+ if [ "${LB_DERIVATIVE}" = "true" ]
+ then
+ # Temporary hack (FIXME)
+ Chroot chroot "apt-get ${APT_OPTIONS} --force-yes install ${LB_KEYRING_PACKAGES}"
+ else
+ Apt chroot "install ${LB_KEYRING_PACKAGES}"
+ fi
fi
rm -rf chroot/var/cache/apt/*.bin
@@ -695,7 +698,7 @@ EOF
fi
;;
- ubuntu)
+ ubuntu|kubuntu)
echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
@@ -754,7 +757,6 @@ EOF
fi
# probably too bold, needs refinment (FIXME)
- rm -f chroot/etc/apt/conf.d/*
rm -f chroot/etc/apt/preferences.d/*
# Configure third-party archives
@@ -772,97 +774,99 @@ EOF
continue
fi
- # Adding apt sources (binary)
- for _FILE in "${_BASE}/archives/${REPOSITORY}" "${_BASE}/archives/${REPOSITORY}.binary"
- do
- if [ -e "${_FILE}" ]
- then
- sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
- -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
- -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
- "${_FILE}" > "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
- fi
- done
+ # Adding sources.list entries (binary)
+ if [ -e "${_BASE}/archives/${REPOSITORY}.binary" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
+ "${_BASE}/archives/${REPOSITORY}.binary" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ elif [ -e "${_BASE}/archives/${REPOSITORY}" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
+ "${_BASE}/archives/${REPOSITORY}" > \
+ "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
+ fi
- # Adding apt configuration (binary)
- for _FILE in "${_BASE}/archives/${REPOSITORY}.conf" "${_BASE}/archives/${REPOSITORY}.conf.binary"
- do
- if [ -e "${_FILE}" ]
+ # Adding pinning preferences (binary)
+ if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ]
+ then
+ cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d
+ elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.binary" ]
+ then
+ cp "${_BASE}/archives/${REPOSITORY}.pref.binary" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref"
+ fi
+
+ if [ "${LB_APT_SECURE}" != false ]
+ then
+ # Adding archive signing keys (binary)
+ if [ -e "${_BASE}/archives/${REPOSITORY}.key.binary" ]
then
- cp "${_FILE}" "chroot/etc/apt/conf.d/${REPOSITORY}.conf"
+ cat "${_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -"
+ elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ]
+ then
+ cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
fi
- done
+ fi
+ done
+ fi
- # Adding apt preferences (binary)
- for _FILE in "${_BASE}/archives/${REPOSITORY}.pref" "${_BASE}/archives/${REPOSITORY}.pref.binary"
- do
- if [ -e "${_FILE}" ]
+ # Check local sources.list
+ if Find_files config/archives/*.list || \
+ Find_files config/archives/*.list.binary
+ then
+ for FILE in config/archives/*.list \
+ config/archives/*.list.binary
+ do
+ if [ -e "${FILE}" ]
+ then
+ sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
+ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+ -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
+ -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
+ "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
+
+ if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
then
- cp "${_FILE}" "chroot/etc/apt/preferences.d/${REPOSITORY}.pref"
+ # Strip out source archives
+ sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
fi
- done
+ fi
+ done
+ fi
- # Adding apt keys (binary)
- if [ "${LB_APT_SECURE}" != false ]
+ # Check local pinning preferences
+ if Find_files config/archives/*.pref || \
+ Find_files config/archives/*.pref.binary
+ then
+ for FILE in config/archives/*.pref \
+ config/archives/*.pref.binary
+ do
+ if [ -e "${FILE}" ]
then
- for _FILE in "${_BASE}/archives/${REPOSITORY}.key" "${_BASE}/archives/${REPOSITORY}.key.binary"
- do
- if [ -e "${_FILE}" ]
- then
- cat "${_FILE}" | Chroot chroot "apt-key add -"
- fi
- done
+ cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
fi
done
fi
- # Adding local apt sources (binary)
- for FILE in config/archives/*.list config/archives/*.list.binary
- do
- if [ -e "${FILE}" ]
- then
- sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
- -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
- -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
- -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
- "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
-
- if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
+ # Check local archive keys
+ if Find_files config/archives/*.key || \
+ Find_files config/archives/*.key.binary
+ then
+ for FILE in config/archives/*.key \
+ config/archives/*.key.binary
+ do
+ if [ -e "${FILE}" ]
then
- # Strip out source archives
- sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
+ cp ${FILE} chroot/root
+ Chroot chroot "apt-key add /root/$(basename ${FILE})"
+ rm -f chroot/root/$(basename ${FILE})
fi
- fi
- done
-
- # Adding local apt configuration (binary)
- for FILE in config/archives/*.conf config/archives/*.conf.binary
- do
- if [ -e "${FILE}" ]
- then
- cp ${FILE} chroot/etc/apt/conf.d/$(basename ${FILE} .binary)
- fi
- done
-
- # Adding local apt preferences (binary)
- for FILE in config/archives/*.pref config/archives/*.pref.binary
- do
- if [ -e "${FILE}" ]
- then
- cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
- fi
- done
-
- # Adding local apt keys (binary)
- for FILE in config/archives/*.key config/archives/*.key.binary
- do
- if [ -e "${FILE}" ]
- then
- cp ${FILE} chroot/root
- Chroot chroot "apt-key add /root/$(basename ${FILE})"
- rm -f chroot/root/$(basename ${FILE})
- fi
- done
+ done
+ fi
# Updating indices
Apt chroot update
@@ -883,9 +887,9 @@ EOF
rm -rf chroot/root/packages
# Remove local packages key if it exists
- if Chroot chroot apt-key list | grep -q ${_LB_LOCAL_KEY_EMAIL}
+ if apt-key list | grep -q ${_LB_LOCAL_KEY_EMAIL}
then
- Chroot chroot apt-key del ${_LB_LOCAL_KEY_EMAIL}
+ apt-key del ${_LB_LOCAL_KEY_EMAIL}
fi
# Removing stage file