Harmonizing apt configuration handling in chroot_archives.

This commit is contained in:
Daniel Baumann 2012-12-04 12:04:47 +01:00
parent 8465c9650f
commit 9117fd0ba4
1 changed files with 112 additions and 147 deletions

View File

@ -217,83 +217,68 @@ EOF
continue continue
fi fi
# Adding sources.list entries (chroot) # Adding apt sources (chroot)
if [ -e "${_BASE}/archives/${REPOSITORY}.chroot" ] for _FILE in "${_BASE}/archives/${REPOSITORY}" "${_BASE}/archives/${REPOSITORY}.chroot"
then do
sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ if [ -e "${_FILE}" ]
-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ then
-e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
"${_BASE}/archives/${REPOSITORY}.chroot" > \ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
"chroot/etc/apt/sources.list.d/${REPOSITORY}.list" -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
elif [ -e "${_BASE}/archives/${REPOSITORY}" ] "${_FILE}" > "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
then fi
sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ done
-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) # Adding apt preferences (chroot)
if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ] for _FILE in "${_BASE}/archives/${REPOSITORY}.pref" "${_BASE}/archives/${REPOSITORY}.pref.chroot"
then do
cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d if [ -e "${_FILE}" ]
elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.chroot" ] then
then cp "${_FILE}" "chroot/etc/apt/preferences.d/${REPOSITORY}.pref"
cp "${_BASE}/archives/${REPOSITORY}.pref.chroot" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref" fi
fi done
# Adding apt keys (chroot)
if [ "${LB_APT_SECURE}" != false ] if [ "${LB_APT_SECURE}" != false ]
then then
# Adding archive signing keys (chroot) for _FILE in "${_BASE}/archives/${REPOSITORY}.key" "${_BASE}/archives/${REPOSITORY}.key.chroot"
if [ -e "${_BASE}/archives/${REPOSITORY}.key.chroot" ] do
then if [ -e "${_FILE}" ]
cat "${_BASE}/archives/${REPOSITORY}.key.chroot" | Chroot chroot "apt-key add -" then
elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ] cat "${_FILE}" | Chroot chroot "apt-key add -"
then fi
cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -" done
fi
fi fi
done done
fi fi
# Check local sources.list # Adding local apt sources (chroot)
if Find_files config/archives/*.list || \ for FILE in config/archives/*.list config/archives/*.list.chroot
Find_files config/archives/*.list.chroot do
then if [ -e "${FILE}" ]
for FILE in config/archives/*.list \ then
config/archives/*.list.chroot sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
do -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
if [ -e "${FILE}" ] -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 then
sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \ # Strip out source archives
-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
-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 fi
done fi
fi done
# Check local pinning preferences # Adding local apt preferences (chroot)
if Find_files config/archives/*.pref || \ for FILE in config/archives/*.pref config/archives/*.pref.chroot
Find_files config/archives/*.pref.chroot do
then if [ -e "${FILE}" ]
for FILE in config/archives/*.pref \ then
config/archives/*.pref.chroot cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
do fi
if [ -e "${FILE}" ] done
then
cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
fi
done
fi
# Configure local package repository # Configure local package repository
if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb
@ -774,99 +759,79 @@ EOF
continue continue
fi fi
# Adding sources.list entries (binary) # Adding apt sources (binary)
if [ -e "${_BASE}/archives/${REPOSITORY}.binary" ] for _FILE in "${_BASE}/archives/${REPOSITORY}" "${_BASE}/archives/${REPOSITORY}.binary"
then do
sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ if [ -e "${_FILE}" ]
-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ then
-e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
"${_BASE}/archives/${REPOSITORY}.binary" > \ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
"chroot/etc/apt/sources.list.d/${REPOSITORY}.list" -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
elif [ -e "${_BASE}/archives/${REPOSITORY}" ] "${_FILE}" > "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
then fi
sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ done
-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) # Adding apt preferences (binary)
if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ] for _FILE in "${_BASE}/archives/${REPOSITORY}.pref" "${_BASE}/archives/${REPOSITORY}.pref.binary"
then do
cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d if [ -e "${_FILE}" ]
elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.binary" ] then
then cp "${_FILE}" "chroot/etc/apt/preferences.d/${REPOSITORY}.pref"
cp "${_BASE}/archives/${REPOSITORY}.pref.binary" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref" fi
fi done
# Adding apt keys (binary)
if [ "${LB_APT_SECURE}" != false ] if [ "${LB_APT_SECURE}" != false ]
then then
# Adding archive signing keys (binary) for _FILE in "${_BASE}/archives/${REPOSITORY}.key" "${_BASE}/archives/${REPOSITORY}.key.binary"
if [ -e "${_BASE}/archives/${REPOSITORY}.key.binary" ] do
then if [ -e "${_FILE}" ]
cat "${_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -" then
elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ] cat "${_FILE}" | Chroot chroot "apt-key add -"
then fi
cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -" done
fi
fi fi
done done
fi fi
# Check local sources.list # Adding local apt sources (binary)
if Find_files config/archives/*.list || \ for FILE in config/archives/*.list config/archives/*.list.binary
Find_files config/archives/*.list.binary do
then if [ -e "${FILE}" ]
for FILE in config/archives/*.list \ then
config/archives/*.list.binary sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
do -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
if [ -e "${FILE}" ] -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 then
sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \ # Strip out source archives
-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
-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
# Strip out source archives
sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
fi
fi fi
done fi
fi done
# Check local pinning preferences # Adding local apt preferences (binary)
if Find_files config/archives/*.pref || \ for FILE in config/archives/*.pref config/archives/*.pref.binary
Find_files config/archives/*.pref.binary do
then if [ -e "${FILE}" ]
for FILE in config/archives/*.pref \ then
config/archives/*.pref.binary cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
do fi
if [ -e "${FILE}" ] done
then
cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
fi
done
fi
# Check local archive keys # Adding local apt keys (binary)
if Find_files config/archives/*.key || \ for FILE in config/archives/*.key config/archives/*.key.binary
Find_files config/archives/*.key.binary do
then if [ -e "${FILE}" ]
for FILE in config/archives/*.key \ then
config/archives/*.key.binary cp ${FILE} chroot/root
do Chroot chroot "apt-key add /root/$(basename ${FILE})"
if [ -e "${FILE}" ] rm -f chroot/root/$(basename ${FILE})
then fi
cp ${FILE} chroot/root done
Chroot chroot "apt-key add /root/$(basename ${FILE})"
rm -f chroot/root/$(basename ${FILE})
fi
done
fi
# Updating indices # Updating indices
Apt chroot update Apt chroot update