Commit dba285d5 by Antonio Terceiro

lxc-debian: don't hardcode valid releases

This avoids the dance of updating the list of valid releases every time Debian makes a new release. It also fixes the following bug: even though lxc-debian will default to creating containers of the latest stable by querying the archive, it won't allow you to explicitly request `stable` because the current list of valid releases don't include it. Last, but not least, avoid hitting the mirror in the case the desired release is one of the ones we know will always be there, i.e. stable, testing, sid, and unstable. Signed-off-by: 's avatarAntonio Terceiro <terceiro@debian.org>
parent c99055ea
...@@ -768,12 +768,13 @@ if [ -n "$authkey" ]; then ...@@ -768,12 +768,13 @@ if [ -n "$authkey" ]; then
fi fi
fi fi
current_release=$(wget "${MIRROR}/dists/stable/Release" -O - 2> /dev/null | head |awk '/^Codename: (.*)$/ { print $2; }') release=${release:-stable}
release=${release:-${current_release}} permanent_releases=('stable' 'testing' 'sid' 'unstable')
valid_releases=('wheezy' 'jessie' 'stretch' 'buster' 'testing' 'sid' 'unstable') if [[ ! "${permanent_releases[*]}" =~ (^|[^[:alpha:]])$release([^[:alpha:]]|$) ]]; then
if [[ ! "${valid_releases[*]}" =~ (^|[^[:alpha:]])$release([^[:alpha:]]|$) ]]; then if ! wget "${MIRROR}/dists/${release}/Release" -O /dev/null 2> /dev/null; then
echo "Invalid release ${release}, valid ones are: ${valid_releases[*]}" echo "Invalid release ${release} (not found in mirror)"
exit 1 exit 1
fi
fi fi
# detect rootfs # detect rootfs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment