]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-alpine: use yaml for detection of latest release
authorNatanael Copa <ncopa@alpinelinux.org>
Wed, 31 Dec 2014 07:31:45 +0000 (08:31 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 5 Jan 2015 21:27:39 +0000 (16:27 -0500)
Alpine Linux provides yaml files with latest release instead of the old
approach with .latest.txt.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-alpine.in

index ba27aeaf1ad496abfb2f69a6933d516e0688383d..187a032534dbb078b119dca399d6a1359cb50c6a 100644 (file)
@@ -28,10 +28,15 @@ get_static_apk () {
 
     if [ -z "$repository" ]; then
         url=http://wiki.alpinelinux.org/cgi-bin/dl.cgi
+       yaml_path="latest-stable/releases/$apk_arch/latest-releases.yaml"
         if [ -z "$release" ]; then
             echo -n "Determining the latest release... "
-            release=$($wget $url/.latest.$apk_arch.txt | \
-                cut -d " " -f 3 | cut -d / -f 1 | uniq)
+            release=$($wget $url/$yaml_path | \
+               awk '$1 == "branch:" {print $2; exit 0}')
+            if [ -z "$release" ]; then
+                release=$($wget $url/.latest.$apk_arch.txt | \
+                    cut -d " " -f 3 | cut -d / -f 1 | uniq)
+            fi
             if [ -z "$release" ]; then
                 echo failed
                 return 1