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,52 +217,43 @@ 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"
do
if [ -e "${_FILE}" ]
then then
sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
-e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
"${_BASE}/archives/${REPOSITORY}.chroot" > \ "${_FILE}" > "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
"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 fi
done
# 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"
do
if [ -e "${_FILE}" ]
then then
cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d cp "${_FILE}" "chroot/etc/apt/preferences.d/${REPOSITORY}.pref"
elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.chroot" ]
then
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
if [ -e "${_FILE}" ]
then then
cat "${_BASE}/archives/${REPOSITORY}.key.chroot" | Chroot chroot "apt-key add -" cat "${_FILE}" | Chroot chroot "apt-key add -"
elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ]
then
cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
fi fi
done
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
then
for FILE in config/archives/*.list \
config/archives/*.list.chroot
do do
if [ -e "${FILE}" ] if [ -e "${FILE}" ]
then then
@ -279,21 +270,15 @@ EOF
fi fi
fi fi
done done
fi
# 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
then
for FILE in config/archives/*.pref \
config/archives/*.pref.chroot
do do
if [ -e "${FILE}" ] if [ -e "${FILE}" ]
then then
cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot) cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
fi fi
done 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,52 +759,43 @@ 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"
do
if [ -e "${_FILE}" ]
then then
sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
-e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
"${_BASE}/archives/${REPOSITORY}.binary" > \ "${_FILE}" > "chroot/etc/apt/sources.list.d/${REPOSITORY}.list"
"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 fi
done
# 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"
do
if [ -e "${_FILE}" ]
then then
cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d cp "${_FILE}" "chroot/etc/apt/preferences.d/${REPOSITORY}.pref"
elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.binary" ]
then
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
if [ -e "${_FILE}" ]
then then
cat "${_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -" cat "${_FILE}" | Chroot chroot "apt-key add -"
elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ]
then
cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
fi fi
done
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
then
for FILE in config/archives/*.list \
config/archives/*.list.binary
do do
if [ -e "${FILE}" ] if [ -e "${FILE}" ]
then then
@ -836,28 +812,18 @@ EOF
fi fi
fi fi
done done
fi
# 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
then
for FILE in config/archives/*.pref \
config/archives/*.pref.binary
do do
if [ -e "${FILE}" ] if [ -e "${FILE}" ]
then then
cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary) cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
fi fi
done 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
then
for FILE in config/archives/*.key \
config/archives/*.key.binary
do do
if [ -e "${FILE}" ] if [ -e "${FILE}" ]
then then
@ -866,7 +832,6 @@ EOF
rm -f chroot/root/$(basename ${FILE}) rm -f chroot/root/$(basename ${FILE})
fi fi
done done
fi
# Updating indices # Updating indices
Apt chroot update Apt chroot update