ostbuild: Create deploy-qemu subcommand
This commit is contained in:
1 parent
5560c04770
commit
9aa9397e42
7 files changed
+81
-165
No files matched your search
@@ -1,74 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- indent-tabs-mode: nil; -*-
|
||||
# Create ostree-qemu.img file in the current directory, suitable
|
||||
# for booting via qemu.
|
||||
#
|
||||
# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# 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 <<EOF
|
||||
This script should be run as root.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage () {
|
||||
echo "$0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
OBJ=ostree-qemu.img
|
||||
if ! test -f ${OBJ}; then
|
||||
# Hardcoded 6 gigabyte filesystem size here; 6 gigabytes should be
|
||||
# enough for everybody.
|
||||
qemu-img create $OBJ 6G
|
||||
mkfs.ext4 -q -F $OBJ
|
||||
fi
|
||||
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
sleep 1 # Avoid Linux kernel bug, pretty sure it's the new RCU pathname lookup
|
||||
mount -o loop ostree-qemu.img fs
|
||||
|
||||
cd fs
|
||||
|
||||
if ! test -d ./ostree/repo/objects; then
|
||||
mkdir -p ./ostree
|
||||
|
||||
$SRCDIR/gnomeos-setup.sh $(pwd)/ostree
|
||||
fi
|
||||
|
||||
mkdir -p ./run ./home ./root ./sys
|
||||
mkdir -p ./tmp
|
||||
chmod 01777 ./tmp
|
||||
|
||||
mkdir -p $(pwd)/ostree/modules
|
||||
rsync -a -H -v --delete /ostree/modules/ ./ostree/modules/
|
||||
|
||||
cd ..
|
||||
umount fs
|
||||
|
||||
cat << EOF
|
||||
Next, run gnomeos-qemu-pull.sh to copy data.
|
||||
EOF
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- indent-tabs-mode: nil; -*-
|
||||
# Run built image in QEMU
|
||||
#
|
||||
# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# 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 <<EOF
|
||||
This script should be run as root.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage () {
|
||||
cat <<EOF
|
||||
usage: $0 SRC_REPO_PATH CURRENT_REF [REFS...]
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
SRC_REPO_PATH=$1
|
||||
test -n "$SRC_REPO_PATH" || usage
|
||||
shift
|
||||
|
||||
CURRENT_REF=$1
|
||||
test -n "$CURRENT_REF" || usage
|
||||
shift
|
||||
|
||||
if ! test -f ostree-qemu.img; then
|
||||
cat <<EOF
|
||||
ostree-qemu.img not found; You must run gnomeos-qemu-create.sh first
|
||||
EOF
|
||||
fi
|
||||
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
sleep 1 # Avoid Linux kernel bug, pretty sure it's the new RCU pathname lookup
|
||||
mount -o loop ostree-qemu.img fs
|
||||
|
||||
cd fs
|
||||
ostree --repo=./ostree/repo pull-local ${SRC_REPO_PATH} ${CURRENT_REF} "$@"
|
||||
|
||||
cd ostree
|
||||
ostree --repo=./repo checkout --atomic-retarget ${CURRENT_REF}
|
||||
ln -sf ${CURRENT_REF} ${CURRENT_REF}.tmplink
|
||||
mv -T ${CURRENT_REF}.tmplink current
|
||||
|
||||
cd ${WORKDIR}
|
||||
umount fs
|
||||
Reference in new issue
Block a user