[ostree] gnomeos-make-image.sh: Some more sanity checks, and don't use grubby



commit f7f620e6995ec4a3510c0eca828a3cd7863c54a7
Author: Colin Walters <walters verbum org>
Date:   Thu Oct 27 11:15:13 2011 -0400

    gnomeos-make-image.sh: Some more sanity checks, and don't use grubby
    
    grubby --default-kernel fails on F16; let's just use uname -r which
    matches dracut anyways.

 parallel-debian/gnomeos-make-image.sh |   39 +++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/parallel-debian/gnomeos-make-image.sh b/parallel-debian/gnomeos-make-image.sh
index bcea8bd..190c77c 100755
--- a/parallel-debian/gnomeos-make-image.sh
+++ b/parallel-debian/gnomeos-make-image.sh
@@ -28,15 +28,37 @@ DEPENDS="debootstrap qemu-img grubby"
 
 for x in $DEPENDS; do
     if ! command -v $x; then
-        echo "Couldn't find required dependency $x";
+        cat <<EOF
+Couldn't find required dependency $x
+EOF
         exit 1
     fi
 done
 
-OSTREE=${OSTREE:-ostree}
+if test $(id -u) != 0; then
+    cat <<EOF
+This script must be run as root.
+EOF
+    exit 1
+fi
+
+if test -z "${OSTREE}"; then
+    OSTREE=`command -v ostree || true`
+fi
+if test -z "${OSTREE}"; then
+    cat <<EOF
+ERROR:
+Couldn't find ostree; you can set the OSTREE environment variable to point to it
+e.g.: OSTREE=~user/checkout/ostree/ostree $0
+EOF
+    exit 1
+fi
+
 if test -z "$DRACUT"; then
     if ! test -d dracut; then
-        echo "Checking out and patching dracut..."
+        cat <<EOF
+Checking out and patching dracut...
+EOF
         git clone git://git.kernel.org/pub/scm/boot/dracut/dracut.git
         (cd dracut; git am $SRCDIR/0001-Support-OSTree.patch)
         (cd dracut; make)
@@ -128,7 +150,7 @@ if ! test -d ${OBJ}; then
         (cd ostree;
             rev=`cat repo/HEAD`
             $OSTREE checkout --repo=repo HEAD gnomeos-${rev}
-            $OSTREE run-triggers --repo=repo current
+            $OSTREE run-triggers --repo=repo gnomeos-${rev}
             ln -s gnomeos-${rev} current)
     )
     if test -d ${OBJ}; then
@@ -140,8 +162,13 @@ fi
 
 cp ${SRCDIR}/ostree_switch_root ${WORKDIR}
 
-kernel=`grubby --default-kernel`
-kv=$(basename $kernel | sed -e s,vmlinuz-,,)
+kv=`uname -r`
+kernel=/boot/vmlinuz-${kv}
+if ! test -f "${kernel}"; then
+    cat <<EOF
+Failed to find ${kernel}
+EOF
+fi
 
 OBJ=gnomeos-initrd.img
 VOBJ=gnomeos-initrd-${kv}.img



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]