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.
This commit is contained in:
Colin Walters 2011-10-27 11:15:13 -04:00
parent 66011a84e5
commit f7f620e699
1 changed files with 33 additions and 6 deletions

View File

@ -28,15 +28,37 @@ DEPENDS="debootstrap qemu-img grubby"
for x in $DEPENDS; do for x in $DEPENDS; do
if ! command -v $x; then if ! command -v $x; then
echo "Couldn't find required dependency $x"; cat <<EOF
Couldn't find required dependency $x
EOF
exit 1 exit 1
fi fi
done 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 -z "$DRACUT"; then
if ! test -d 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 git clone git://git.kernel.org/pub/scm/boot/dracut/dracut.git
(cd dracut; git am $SRCDIR/0001-Support-OSTree.patch) (cd dracut; git am $SRCDIR/0001-Support-OSTree.patch)
(cd dracut; make) (cd dracut; make)
@ -128,7 +150,7 @@ if ! test -d ${OBJ}; then
(cd ostree; (cd ostree;
rev=`cat repo/HEAD` rev=`cat repo/HEAD`
$OSTREE checkout --repo=repo HEAD gnomeos-${rev} $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) ln -s gnomeos-${rev} current)
) )
if test -d ${OBJ}; then if test -d ${OBJ}; then
@ -140,8 +162,13 @@ fi
cp ${SRCDIR}/ostree_switch_root ${WORKDIR} cp ${SRCDIR}/ostree_switch_root ${WORKDIR}
kernel=`grubby --default-kernel` kv=`uname -r`
kv=$(basename $kernel | sed -e s,vmlinuz-,,) kernel=/boot/vmlinuz-${kv}
if ! test -f "${kernel}"; then
cat <<EOF
Failed to find ${kernel}
EOF
fi
OBJ=gnomeos-initrd.img OBJ=gnomeos-initrd.img
VOBJ=gnomeos-initrd-${kv}.img VOBJ=gnomeos-initrd-${kv}.img