[Merge] lp:~vicamo/lxc-android-config/lxd-migration into lp:lxc-android-config
Vicamo Yang
vicamo at gmail.com
Thu Nov 17 07:26:23 UTC 2016
Diff comments:
>
> === added file 'usr/lib/lxc-android-config/create-lxd-image'
> --- usr/lib/lxc-android-config/create-lxd-image 1970-01-01 00:00:00 +0000
> +++ usr/lib/lxc-android-config/create-lxd-image 2016-11-17 07:13:58 +0000
> @@ -0,0 +1,57 @@
> +#!/bin/sh
> +
> +set -e
> +
> +IMAGE_NAME=${1:-android}
> +[ -z "$(lxc image --force-local list | grep ${IMAGE_NAME})" ] || exit 0
> +
> +WORKDIR=$(mktemp -d)
> +trap "{ cd /; rm -rf '$WORKDIR'; }" EXIT
> +cd "$WORKDIR"
> +
> +mkdir -p image/rootfs
> +cat /android/system/boot/android-ramdisk.img | \
> + gzip -d | \
> + (cd image/rootfs; cpio -i)
> +env LXC_ROOTFS_PATH="$WORKDIR"/image/rootfs run-parts /var/lib/lxc/android/pre-start.d || true
> +sed -i "/mount_all /d" image/rootfs/init.*.rc || true
> +sed -i "/on nonencrypted/d" image/rootfs/init.rc
> +rm -Rf image/rootfs/vendor
> +ln -s /system/vendor image/rootfs/vendor
> +if [ -f /custom/custom.prop ]; then
> + cat /custom/custom.prop >> image/rootfs/default.prop
> +fi
I personally feel like to move these custom property lines into pre-start hooks, but confirmation from people who really use them is needed. So right now I put it in this systemd-only ExecStartPre script. Actually the ideal case should be moving everything into that pre-start.d instead.
> +
> +cat >image/metadata.yaml <<EOF
> +architecture: aarch64
> +creation_date: $(date +%s)
> +properties:
> + description: Ubuntu Touch device rootfs
> + os: android
> + release: 5.1
> +EOF
> +
> +tar -C image -Jcpf rootfs.tar.xz metadata.yaml rootfs
> +lxc image --force-local import rootfs.tar.xz --alias ${IMAGE_NAME}
> +
> +PROFILE_NAME=${2:-${IMAGE_NAME}}
> +if [ -n "$(lxc profile --force-local list | grep ${PROFILE_NAME})" ]; then
> + lxc profile --force-local delete ${PROFILE_NAME}
> +fi
> +lxc profile --force-local create ${PROFILE_NAME}
> +lxc profile --force-local set ${PROFILE_NAME} security.privileged true
> +lxc profile --force-local set ${PROFILE_NAME} security.nesting true
> +lxc profile --force-local set ${PROFILE_NAME} raw.lxc lxc.aa_profile=unconfined
> +lxc profile --force-local device add ${PROFILE_NAME} \
> + dev_socket disk path=/dev/socket source=/dev/socket
> +for dir in /android/*; do
> + name=$(basename $dir)
> + lxc profile --force-local device add ${PROFILE_NAME} \
> + $name disk path=/$name source=$dir recursive=true
> +done
> +lxc profile --force-local show ${PROFILE_NAME} | \
> + 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!' | \
> + sed 's!^description: .*$!description: "Ubuntu Touch android container"!' | \
> + lxc profile --force-local edit ${PROFILE_NAME}
> +
> +exit 0
--
https://code.launchpad.net/~vicamo/lxc-android-config/lxd-migration/+merge/311103
Your team Ubuntu Phablet Team is requested to review the proposed merge of lp:~vicamo/lxc-android-config/lxd-migration into lp:lxc-android-config.
More information about the Ubuntu-reviews
mailing list