summaryrefslogtreecommitdiff
path: root/scripts/build/chroot_archives
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2012-12-04 12:04:47 +0100
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 14:50:01 +0200
commitbc985a6a32a0669f6a179324c213f7d478228ecb (patch)
tree4bffb5eb7cfade813dc967b5720f04fcbc1161b0 /scripts/build/chroot_archives
parentba0fe4cdc3b2534bcba2f01ec10814e3334836f7 (diff)
downloadvyos-live-build-bc985a6a32a0669f6a179324c213f7d478228ecb.tar.gz
vyos-live-build-bc985a6a32a0669f6a179324c213f7d478228ecb.zip
Harmonizing apt configuration handling in chroot_archives.
Diffstat (limited to 'scripts/build/chroot_archives')
-rwxr-xr-xscripts/build/chroot_archives257
1 files changed, 111 insertions, 146 deletions
diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives
index 3785b65ba..27c8acc83 100755
--- a/scripts/build/chroot_archives
+++ b/scripts/build/chroot_archives
@@ -217,83 +217,68 @@ EOF
continue
fi
- # 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 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
-
- 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" ]
+ # Adding apt sources (chroot)
+ for _FILE in "${_BASE}/archives/${REPOSITORY}" "${_BASE}/archives/${REPOSITORY}.chroot"
+ do
+ if [ -e "${_FILE}" ]
then
- cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
+ 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
- fi
- done
- fi
-
- # 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
- 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)"
+ done
- if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
+ # Adding apt preferences (chroot)
+ for _FILE in "${_BASE}/archives/${REPOSITORY}.pref" "${_BASE}/archives/${REPOSITORY}.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/${REPOSITORY}.pref"
fi
+ done
+
+ # Adding apt keys (chroot)
+ if [ "${LB_APT_SECURE}" != false ]
+ 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
fi
done
fi
- # 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}" ]
+ # 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" ]
then
- cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
+ # Strip out source archives
+ sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
fi
- done
- fi
+ 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
# Configure local package repository
if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb
@@ -774,99 +759,79 @@ EOF
continue
fi
- # 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 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
- cat "${_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -"
- elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ]
+ # Adding apt sources (binary)
+ for _FILE in "${_BASE}/archives/${REPOSITORY}" "${_BASE}/archives/${REPOSITORY}.binary"
+ do
+ if [ -e "${_FILE}" ]
then
- cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
+ 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
- fi
- done
- fi
-
- # 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)"
+ done
- if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ]
+ # Adding apt preferences (binary)
+ for _FILE in "${_BASE}/archives/${REPOSITORY}.pref" "${_BASE}/archives/${REPOSITORY}.pref.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/etc/apt/preferences.d/${REPOSITORY}.pref"
fi
- fi
- done
- fi
+ done
- # 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}" ]
+ # Adding apt keys (binary)
+ if [ "${LB_APT_SECURE}" != false ]
then
- cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
+ 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
fi
done
fi
- # 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}" ]
+ # 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" ]
then
- cp ${FILE} chroot/root
- Chroot chroot "apt-key add /root/$(basename ${FILE})"
- rm -f chroot/root/$(basename ${FILE})
+ # Strip out source archives
+ sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
fi
- done
- fi
+ 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
# Updating indices
Apt chroot update