[lxc-devel] [PATCH] lxc-alpine: make --release work when apk exists

Natanael Copa ncopa at alpinelinux.org
Fri Jun 28 14:56:51 UTC 2013


Use sed to set the specified alpine release in the copied
/etc/apk/repositories

Signed-off-by: Natanael Copa <ncopa at alpinelinux.org>
---
 templates/lxc-alpine.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
index 410c817..be2a535 100644
--- a/templates/lxc-alpine.in
+++ b/templates/lxc-alpine.in
@@ -84,6 +84,10 @@ install_alpine() {
         echo "$repository" > "$rootfs"/etc/apk/repositories
     else
         cp /etc/apk/repositories "$rootfs"/etc/apk/repositories || return 1
+        if [ -n "$release" ]; then
+            sed -i -e "s:/[^/]\+/\([^/]\+\)$:/$release/\1:" \
+                "$rootfs"/etc/apk/repositories
+        fi
     fi
     opt_arch=
     if [ -n "$apk_arch" ]; then
-- 
1.8.3.1





More information about the lxc-devel mailing list