summaryrefslogtreecommitdiffstats
path: root/share/build-scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2024-08-29 09:38:30 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2024-08-29 11:21:49 +0000
commit46851c1dd1ec771dea886eaf92bc25e739babb6f (patch)
treeec3ed403b29aaf644aac4cd927ec0fad60b8be04 /share/build-scripts
parentAdding example preseeding for local archives. (diff)
downloadcompute-tools-46851c1dd1ec771dea886eaf92bc25e739babb6f.tar.xz
compute-tools-46851c1dd1ec771dea886eaf92bc25e739babb6f.zip
Switching from apt list files to sources files.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/build-scripts')
-rwxr-xr-xshare/build-scripts/debconf91
-rwxr-xr-xshare/build-scripts/debconf.d/0003-debconf34
2 files changed, 94 insertions, 31 deletions
diff --git a/share/build-scripts/debconf b/share/build-scripts/debconf
index d6739ad..eb25613 100755
--- a/share/build-scripts/debconf
+++ b/share/build-scripts/debconf
@@ -490,15 +490,19 @@ Configure_apt ()
DIRECTORY="${1}"
# Configure apt
- rm -f "${DIRECTORY}/etc/apt/sources.list"
+ rm -f "${DIRECTORY}/etc/apt/sources.list" "${DIRECTORY}/etc/apt/sources.list.d/debian.sources"
PARENT_AREA="$(echo ${PARENT_ARCHIVE_AREAS} | sed -e 's|,| |g')"
PARENT_DIST="$(echo ${PARENT_DISTRIBUTION} | sed -e 's|-backports||')"
-cat > "${DIRECTORY}/etc/apt/sources.list.d/debian.list" << EOF
-# /etc/apt/sources.list.d/debian.list
+cat > "${DIRECTORY}/etc/apt/sources.list.d/debian.sources" << EOF
+# /etc/apt/sources.list.d/debian.sources
-deb ${PARENT_MIRROR} ${PARENT_DIST} ${PARENT_AREA}
+Types: deb
+URIs: ${PARENT_MIRROR}
+Suites: ${PARENT_DIST}
+Components: ${PARENT_AREA}
+PDiffs: no
EOF
case "${MODE}" in
@@ -571,46 +575,89 @@ Configure_system ()
echo "${NAME}" > "${DIRECTORY}/etc/hostname"
# Configure apt
- rm -f "${DIRECTORY}/etc/apt/sources.list"
+ rm -f "${DIRECTORY}/etc/apt/sources.list" "${DIRECTORY}/etc/apt/sources.list.d/debian.sources"
PARENT_AREA="$(echo ${PARENT_ARCHIVE_AREAS} | sed -e 's|,| |g')"
PARENT_DIST="$(echo ${PARENT_DISTRIBUTION} | sed -e 's|-backports||')"
-cat > "${DIRECTORY}/etc/apt/sources.list.d/debian.list" << EOF
-# /etc/apt/sources.list.d/debian.list
+cat > "${DIRECTORY}/etc/apt/sources.list.d/debian.sources" << EOF
+# /etc/apt/sources.list.d/debian.sources
-deb ${PARENT_MIRROR} ${PARENT_DIST} ${PARENT_AREA}
+Types: deb
+URIs: ${PARENT_MIRROR}
+Suites: ${PARENT_DIST}
+Components: ${PARENT_AREA}
+PDiffs: no
EOF
+ AUTOMATIC_SUITES=""
+
for PARENT_REPO in ${PARENT_ARCHIVES}
do
case "${PARENT_REPO}" in
- buster-security)
- echo "deb ${PARENT_MIRROR_SECURITY} ${PARENT_DIST}/updates ${PARENT_AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/debian.list"
+ ${PARENT_DIST}-updates)
+ AUTOMATIC_SUITES="${AUTOMATIC_SUITES} ${PARENT_DIST}-updates"
;;
- ${PARENT_DIST}-security)
- echo "deb ${PARENT_MIRROR_SECURITY} ${PARENT_DIST}-security ${PARENT_AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/debian.list"
+ ${PARENT_DIST}-proposed-updates)
+ AUTOMATIC_SUITES="${AUTOMATIC_SUITES} ${PARENT_DIST}-proposed-updates"
;;
- ${PARENT_DIST}-updates)
- echo "deb ${PARENT_MIRROR} ${PARENT_DIST}-updates ${PARENT_AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/debian.list"
+ ${PARENT_DIST}-backports)
+ AUTOMATIC_SUITES="${AUTOMATIC_SUITES} ${PARENT_DIST}-backports"
;;
- ${PARENT_DIST}-backports)
- echo "deb ${PARENT_MIRROR} ${PARENT_DIST}-backports ${PARENT_AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/debian.list"
+ ${PARENT_DIST}-experimental)
+ AUTOMATIC_SUITES="${AUTOMATIC_SUITES} experimental"
;;
+ esac
+ done
- ${PARENT_DIST}-proposed-updates)
- echo "deb ${PARENT_MIRROR} ${PARENT_DIST}-proposed-updates ${PARENT_AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/debian.list"
+ if [ -n "${AUTOMATIC_SUITES}" ]
+ then
+ AUTOMATIC_SUITES="$(echo ${AUTOMATIC_SUITES} | sed -e 's|^ ||')"
+
+cat >> "${DIRECTORY}/etc/apt/sources.list.d/debian.sources" << EOF
+
+Types: deb
+URIs: ${PARENT_MIRROR}
+Suites: ${AUTOMATIC_SUITES}
+Components: ${PARENT_AREA}
+PDiffs: no
+EOF
+
+ fi
+
+ SECURITY_SUITES=""
+
+ for PARENT_REPO in ${PARENT_ARCHIVES}
+ do
+ case "${PARENT_REPO}" in
+ buster-security)
+ SECURITY_SUITES="${SECURITY_SUITES} ${PARENT_DIST}/updates"
;;
- experimental)
- echo "deb ${PARENT_MIRROR} experimental ${PARENT_AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/debian.list"
+ ${PARENT_DIST}-security)
+ SECURITY_SUITES="${SECURITY_SUITES} ${PARENT_DIST}-security"
;;
esac
done
+ if [ -n "${SECURITY_SUITES}" ]
+ then
+ SECURITY_SUITES="$(echo ${SECURITY_SUITES} | sed -e 's|^ ||')"
+
+cat >> "${DIRECTORY}/etc/apt/sources.list.d/debian.sources" << EOF
+
+Types: deb
+URIs: ${PARENT_MIRROR_SECURITY}
+Suites: ${PARENT_DIST}-security
+Components: ${PARENT_AREA}
+PDiffs: no
+EOF
+
+ fi
+
case "${MODE}" in
progress-linux)
@@ -636,9 +683,9 @@ EOF
fi
# Add local archives configured from preseed file
- if ls "${DEBCONF_TMPDIR}/apt"/*.list > /dev/null 2>&1
+ if ls "${DEBCONF_TMPDIR}/apt"/*.sources > /dev/null 2>&1
then
- cp "${DEBCONF_TMPDIR}/apt"/*.list "${DIRECTORY}/etc/apt/sources.list.d"
+ cp "${DEBCONF_TMPDIR}/apt"/*.sources "${DIRECTORY}/etc/apt/sources.list.d"
if ls "${DEBCONF_TMPDIR}/apt"/*.key > /dev/null 2>&1
then
diff --git a/share/build-scripts/debconf.d/0003-debconf b/share/build-scripts/debconf.d/0003-debconf
index e12e25e..bd171c1 100755
--- a/share/build-scripts/debconf.d/0003-debconf
+++ b/share/build-scripts/debconf.d/0003-debconf
@@ -664,12 +664,16 @@ Local_archives ()
do
mkdir -p "${DEBCONF_TMPDIR}/apt"
- REPOSITORY="${RET#deb }"
+ REPOSITORY="$(echo "${RET}" | sed -e 's|^deb ||')"
- LIST="archive${NUMBER}.list"
+ MIRROR="$(echo ${REPOSITORY} | cut -d' ' -f1)"
+ SUITES="$(echo ${REPOSITORY} | cut -d' ' -f2)"
+ AREAS="$(echo ${REPOSITORY} | cut -d' ' -f3-)"
+
+ LIST="archive${NUMBER}.sources"
if db_get container/archive${NUMBER}/list
then
- LIST="$(basename ${RET} .list).list"
+ LIST="$(basename ${RET} .sources).sources"
fi
COMMENT=""
@@ -677,14 +681,18 @@ Local_archives ()
then
COMMENT="${RET}"
- echo "# ${COMMENT}" > "${DEBCONF_TMPDIR}/apt/${LIST}"
- fi
+cat > "${DEBCONF_TMPDIR}/apt/${LIST}" << EOF
+# ${COMMENT}
- echo "deb ${REPOSITORY}" >> "${DEBCONF_TMPDIR}/apt/${LIST}"
+EOF
+
+ fi
if db_get container/archive${NUMBER}/source && [ "$RET" = true ]
then
- echo "deb-src ${REPOSITORY}" >> "${DEBCONF_TMPDIR}/apt/${LIST}"
+ TYPES="deb deb-src"
+ else
+ TYPES="deb"
fi
KEY=""
@@ -692,9 +700,17 @@ Local_archives ()
then
KEY="${RET}"
- wget -q "${KEY}" -O "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .list).key"
+ wget -q "${KEY}" -O "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .sources).key"
fi
+cat > "${DEBCONF_TMPDIR}/apt/${LIST}" << EOF
+Types: deb
+URIs: ${MIRROR}
+Suites: ${SUITES}
+Components: ${AREAS}
+PDiffs: no
+EOF
+
PREFERENCES_PACKAGE=""
PREFERENCES_PIN=""
PREFERENCES_PIN_PRIORITY=""
@@ -715,7 +731,7 @@ Local_archives ()
if [ -n "${PREFERENCES_PACKAGE}" ] || [ -n "${PREFERENCES_PIN}" ] || [ -n "${PREFERENCES_PIN_PRIORITY}" ]
then
-cat > "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .list).pref" << EOF
+cat >> "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .sources).pref" << EOF
Package: ${PREFERENCES_PACKAGE}
Pin: ${PREFERENCES_PIN}
Pin-Priority: ${PREFERENCES_PIN_PRIORITY}