#!/bin/sh # -*- indent-tabs-mode: nil; -*- # Run built image in QEMU # # Copyright (C) 2011,2012 Colin Walters # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. set -e set -x SRCDIR=`dirname $0` WORKDIR=`pwd` if test $(id -u) != 0; then cat < ./ostree/var/lib/dbus/machine-id mkdir ./ostree/var/lib/gdm chown 2:2 ./ostree/var/lib/gdm touch ./ostree/var/shadow chmod 0600 ./ostree/var/shadow mkdir ostree/repo ostree --repo=ostree/repo init cat >ostree/var/passwd << EOF root::0:0:root:/:/bin/sh dbus:*:1:1:dbus:/:/bin/false gdm:*:2:2:gdm:/var/lib/gdm:/bin/false EOF cat >ostree/var/group << EOF root:*:0:root dbus:*:1: gdm:*:2: EOF fi cd ostree ostree --repo=${OSTREE_REPO} local-clone repo ${BRANCH_PREFIX}runtime ${BRANCH_PREFIX}devel for branch in runtime devel; do rev=$(ostree --repo=repo rev-parse ${BRANCH_PREFIX}${branch}); if ! test -d ${BRANCH_PREFIX}${branch}-${rev}; then ostree --repo=repo checkout ${rev} ${BRANCH_PREFIX}${branch}-${rev}.tmp ostbuild chroot-run-triggers ${BRANCH_PREFIX}${branch}-${rev}.tmp if test x$TYPE = xcurrent; then cp -ar /lib/modules/`uname -r` ${BRANCH_PREFIX}${branch}-${rev}.tmp/lib/modules fi mv ${BRANCH_PREFIX}${branch}-${rev}{.tmp,} fi rm -f ${BRANCH_PREFIX}${branch}-current ln -s ${BRANCH_PREFIX}${branch}-${rev} ${BRANCH_PREFIX}${branch}-current done cd .. test -d proc || mkdir proc # needed for ostree-init cp -a ./ostree/${BRANCH_PREFIX}${branch}-current/usr/sbin/ostree-init . cd ${WORKDIR} sync umount fs rmdir fs ARGS="rd.plymouth=0 $@" if ! echo $ARGS | grep -q 'init='; then ARGS="init=/ostree-init $ARGS" fi if ! echo $ARGS | grep -q 'ostree='; then ARGS="ostree=${BRANCH_PREFIX}runtime-current $ARGS" fi if test x$TYPE = xqemu; then ARGS="root=/dev/hda $ARGS" KERNEL=./tmp-eglibc/deploy/images/bzImage-qemux86.bin else if test x$TYPE = xcurrent; then ARGS="root=/dev/sda $ARGS" KERNEL=/boot/vmlinuz-`uname -r` INITRD_ARG="-initrd /boot/initramfs-`uname -r`.img" fi fi exec qemu-kvm -kernel ${KERNEL} ${INITRD_ARG} -hda gnomeos-fs.img -net user -net nic,model=virtio -m 512M -append "$ARGS" -monitor stdio