Merge lp:~vicamo/lxc-android-config/lxd-migration into lp:lxc-android-config

Proposed by You-Sheng Yang
Status: Needs review
Proposed branch: lp:~vicamo/lxc-android-config/lxd-migration
Merge into: lp:lxc-android-config
Diff against target: 120 lines (+71/-6)
5 files modified
debian/control (+2/-0)
debian/lxc-android-config.service (+7/-6)
etc/system-image/writable-paths (+2/-0)
lib/systemd/system/urfkill.service.d/lxc-android-config.conf (+3/-0)
usr/lib/lxc-android-config/create-lxd-image (+57/-0)
To merge this branch: bzr merge lp:~vicamo/lxc-android-config/lxd-migration
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+311103@code.launchpad.net

This proposal supersedes a proposal from 2016-11-15.

Description of the change

[LP: 1641549]
* Add writable path for lxd.
* Migrate android container to lxd.
* Depend on lxd, lxd-client.
* Let urfkill wait for android container startup to retrieve wifi specific properties correctly.

To post a comment you must log in.
Revision history for this message
You-Sheng Yang (vicamo) :

Unmerged revisions

37. By You-Sheng Yang

Let urfkill wait for android container startup to retrieve wifi specific properties correctly. (LP: 1641549)

36. By You-Sheng Yang

Depend on lxd, lxd-client. (LP: 1641549)

35. By You-Sheng Yang

Migrate android container to lxd. (LP: 1641549)

34. By You-Sheng Yang

Add writable path for lxd. (LP: 1641549)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-09-02 08:45:46 +0000
3+++ debian/control 2016-11-17 07:13:58 +0000
4@@ -16,6 +16,8 @@
5 Depends: cgmanager,
6 debianutils,
7 lxc (>= 1.1.0~alpha2-0ubuntu1),
8+ lxd,
9+ lxd-client,
10 ${misc:Depends},
11 Breaks: powerd (<< 0.14-0ubuntu1),
12 ubuntu-touch-session (<< 0.107),
13
14=== modified file 'debian/lxc-android-config.service'
15--- debian/lxc-android-config.service 2016-10-04 08:14:24 +0000
16+++ debian/lxc-android-config.service 2016-11-17 07:13:58 +0000
17@@ -1,15 +1,16 @@
18 [Unit]
19 Description=LXC Android Config and Container Initialization
20-Requires=cgmanager.service
21+Requires=cgmanager.service lxd.service
22 Wants=upstart-local-bridge.service
23-After=cgmanager.service upstart-local-bridge.service
24+After=cgmanager.service lxd.service upstart-local-bridge.service
25+Before=lxd-containers.service
26
27 [Service]
28-Type=forking
29+Type=oneshot
30 ExecStartPre=/usr/lib/lxc-android-config/copy-udev-unflipped
31-ExecStart=/usr/bin/lxc-start -n android -d -- /init
32-ExecStartPost=/usr/lib/lxc-android-config/lxc-android-ready
33-ExecStop=/usr/bin/lxc-stop -n android -k
34+ExecStartPre=/usr/lib/lxc-android-config/create-lxd-image
35+ExecStart=/usr/bin/lxc launch --force-local -e -p android android armhf
36+ExecStop=/usr/bin/lxc stop --force armhf
37
38 [Install]
39 WantedBy=multi-user.target
40
41=== modified file 'etc/system-image/writable-paths'
42--- etc/system-image/writable-paths 2016-10-14 08:29:20 +0000
43+++ etc/system-image/writable-paths 2016-11-17 07:13:58 +0000
44@@ -68,3 +68,5 @@
45 # snappy
46 /snap auto persistent transition none
47 /var/lib/snapd auto persistent transition none
48+# lxd
49+/var/lib/lxd auto persistent transition none
50
51=== added directory 'lib/systemd/system/urfkill.service.d'
52=== added file 'lib/systemd/system/urfkill.service.d/lxc-android-config.conf'
53--- lib/systemd/system/urfkill.service.d/lxc-android-config.conf 1970-01-01 00:00:00 +0000
54+++ lib/systemd/system/urfkill.service.d/lxc-android-config.conf 2016-11-17 07:13:58 +0000
55@@ -0,0 +1,3 @@
56+[Unit]
57+Wants=lxc-android-config.service
58+After=lxc-android-config.service
59
60=== added file 'usr/lib/lxc-android-config/create-lxd-image'
61--- usr/lib/lxc-android-config/create-lxd-image 1970-01-01 00:00:00 +0000
62+++ usr/lib/lxc-android-config/create-lxd-image 2016-11-17 07:13:58 +0000
63@@ -0,0 +1,57 @@
64+#!/bin/sh
65+
66+set -e
67+
68+IMAGE_NAME=${1:-android}
69+[ -z "$(lxc image --force-local list | grep ${IMAGE_NAME})" ] || exit 0
70+
71+WORKDIR=$(mktemp -d)
72+trap "{ cd /; rm -rf '$WORKDIR'; }" EXIT
73+cd "$WORKDIR"
74+
75+mkdir -p image/rootfs
76+cat /android/system/boot/android-ramdisk.img | \
77+ gzip -d | \
78+ (cd image/rootfs; cpio -i)
79+env LXC_ROOTFS_PATH="$WORKDIR"/image/rootfs run-parts /var/lib/lxc/android/pre-start.d || true
80+sed -i "/mount_all /d" image/rootfs/init.*.rc || true
81+sed -i "/on nonencrypted/d" image/rootfs/init.rc
82+rm -Rf image/rootfs/vendor
83+ln -s /system/vendor image/rootfs/vendor
84+if [ -f /custom/custom.prop ]; then
85+ cat /custom/custom.prop >> image/rootfs/default.prop
86+fi
87+
88+cat >image/metadata.yaml <<EOF
89+architecture: aarch64
90+creation_date: $(date +%s)
91+properties:
92+ description: Ubuntu Touch device rootfs
93+ os: android
94+ release: 5.1
95+EOF
96+
97+tar -C image -Jcpf rootfs.tar.xz metadata.yaml rootfs
98+lxc image --force-local import rootfs.tar.xz --alias ${IMAGE_NAME}
99+
100+PROFILE_NAME=${2:-${IMAGE_NAME}}
101+if [ -n "$(lxc profile --force-local list | grep ${PROFILE_NAME})" ]; then
102+ lxc profile --force-local delete ${PROFILE_NAME}
103+fi
104+lxc profile --force-local create ${PROFILE_NAME}
105+lxc profile --force-local set ${PROFILE_NAME} security.privileged true
106+lxc profile --force-local set ${PROFILE_NAME} security.nesting true
107+lxc profile --force-local set ${PROFILE_NAME} raw.lxc lxc.aa_profile=unconfined
108+lxc profile --force-local device add ${PROFILE_NAME} \
109+ dev_socket disk path=/dev/socket source=/dev/socket
110+for dir in /android/*; do
111+ name=$(basename $dir)
112+ lxc profile --force-local device add ${PROFILE_NAME} \
113+ $name disk path=/$name source=$dir recursive=true
114+done
115+lxc profile --force-local show ${PROFILE_NAME} | \
116+ sed 's! raw\.lxc: lxc.*$! raw.lxc: |\n lxc.devttydir=lxc\n lxc.tty=4\n lxc.cap.drop=mac_admin mac_override\n lxc.aa_profile=unconfined\n lxc.autodev=0\n lxc.init_cmd=/init\n lxc.cgroup.devices.allow = a\n lxc.mount.auto=\n lxc.mount.auto=sys:rw proc:mixed cgroup:mixed!' | \
117+ sed 's!^description: .*$!description: "Ubuntu Touch android container"!' | \
118+ lxc profile --force-local edit ${PROFILE_NAME}
119+
120+exit 0

Subscribers

People subscribed via source and target branches