summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorAnsgar Burchardt <ansgar@debian.org>2016-09-08 15:28:19 (GMT)
committerAnsgar Burchardt <ansgar@debian.org>2016-09-08 15:28:19 (GMT)
commit81ebc7df61e8a80915126351e01e016f6a57a52a (patch)
treef4d89091242c4536989c503fe55455bfcad8436b /functions
parent71f8a7626cc5c10da0c307fa3f70cb0e0d44a013 (diff)
downloaddebootstrap-81ebc7df61e8a80915126351e01e016f6a57a52a.zip
debootstrap-81ebc7df61e8a80915126351e01e016f6a57a52a.tar.gz
debootstrap-81ebc7df61e8a80915126351e01e016f6a57a52a.tar.bz2
Validate SUITE against Release's Suite or Codename
Bug: https://bugs.debian.org/837075
Diffstat (limited to 'functions')
-rw-r--r--functions14
1 files changed, 14 insertions, 0 deletions
diff --git a/functions b/functions
index 67701ee..336f220 100644
--- a/functions
+++ b/functions
@@ -512,6 +512,18 @@ extract_release_components () {
fi
}
+CODENAME=""
+validate_suite () {
+ local reldest="$1"
+
+ CODENAME=$(sed -n "s/^Codename: *//p" "$reldest")
+ local suite=$(sed -n "s/^Suite: *//p" "$reldest")
+
+ if [ "$SUITE" != "$suite" ] && [ "$SUITE" != "$CODENAME" ]; then
+ error 1 WRONGSUITE "Asked to install suite %s, but got %s (codename: %s) from mirror" "$SUITE" "$suite" "$CODENAME"
+ fi
+}
+
download_release_sig () {
local m1="$1"
local reldest="$2"
@@ -547,6 +559,8 @@ download_release_indices () {
download_release_sig "$m1" "$reldest" "$relsigdest"
+ validate_suite "$reldest"
+
extract_release_components $reldest
local totalpkgs=0