[ostree] gnomeos: Make run script transparently update existing FS image
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] gnomeos: Make run script transparently update existing FS image
- Date: Sun, 4 Dec 2011 19:57:19 +0000 (UTC)
commit f812720fc624fb0ba88fb110ec28e306bff4b95b
Author: Colin Walters <walters verbum org>
Date: Sun Dec 4 14:56:21 2011 -0500
gnomeos: Make run script transparently update existing FS image
This is noticeably faster.
gnomeos/yocto/gnomeos-run.sh | 60 +++++++++++++++++++++++------------------
1 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/gnomeos/yocto/gnomeos-run.sh b/gnomeos/yocto/gnomeos-run.sh
index 12f8e3a..b4d3429 100755
--- a/gnomeos/yocto/gnomeos-run.sh
+++ b/gnomeos/yocto/gnomeos-run.sh
@@ -49,41 +49,49 @@ if (! test -f ${OBJ}); then
rm -f ${OBJ}.tmp
qemu-img create ${OBJ}.tmp 2G
mkfs.ext3 -q -F ${OBJ}.tmp
- mkdir -p fs
- umount fs || true
- mount -o loop ${OBJ}.tmp fs
+ mv ${OBJ}.tmp ${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 gnomeos-fs.img fs
+
+cd fs
- cd fs
+TOPROOT_BIND_MOUNTS="home root tmp"
- TOPROOT_BIND_MOUNTS="home root tmp"
-
- for d in $TOPROOT_BIND_MOUNTS; do
+for d in $TOPROOT_BIND_MOUNTS; do
+ if ! test -d $d; then
mkdir -m 0755 $d
- done
- chmod a=rwxt tmp
+ fi
+done
+chmod a=rwxt tmp
+if ! test -d ostree; then
mkdir ostree
mkdir -p -m 0755 ./ostree/var/{log,run,tmp,spool}
- cd ostree
- mkdir repo
- ostree --repo=repo init
- ostree --repo=${OSTREE_REPO} local-clone repo
- for branch in base dev; do
- rev=$(ostree --repo=repo rev-parse ${BRANCH_PREFIX}${branch});
+ mkdir ostree/repo
+ ostree --repo=ostree/repo init
+fi
+cd ostree
+ostree --repo=${OSTREE_REPO} local-clone repo
+for branch in base dev; 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}
- ln -s ${BRANCH_PREFIX}${branch}-${rev} ${BRANCH_PREFIX}${branch}-current
- done
- cd ..
+ fi
+ ln -sf ${BRANCH_PREFIX}${branch}-${rev} ${BRANCH_PREFIX}${branch}-current
+done
+cd ..
- mkdir proc # needed for ostree-init
- cp -a ./ostree/${BRANCH_PREFIX}base-current/usr/sbin/ostree-init .
+test -d proc || mkdir proc # needed for ostree-init
+cp -a ./ostree/${BRANCH_PREFIX}base-current/usr/sbin/ostree-init .
- cd ${WORKDIR}
-
- umount fs
- rmdir fs
- mv ${OBJ}.tmp ${OBJ}
-fi
+cd ${WORKDIR}
+
+umount fs
+rmdir fs
ARGS="$@"
if ! echo $ARGS | grep -q 'init='; then
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]