#!/bin/sh # Updates an installer initrd with a new loader and init binary # Usage: upd-initrd # # Jeremy Katz # Copyright 2005 Red Hat, Inc. # Modified 21-Feb-2006 by David Cantrell if [ $# -ne 1 ]; then echo "Usage: $0 " exit 1 fi CWD=$(pwd) INITRD=$(readlink -f $1) TMPINITRD=initrd.img-$$ tmpdir=$(mktemp -d) pushd $tmpdir gzip -dc $INITRD |cpio -id ismainframe=no if [ -f $CWD/loader ]; then if [ ! -z "$(file $CWD/loader | grep "S/390")" ]; then ismainframe=yes fi fi if [ -f $CWD/loader ]; then strip -s -o sbin/loader $CWD/loader fi if [ "$ismainframe" = "yes" ]; then if [ -f $CWD/linuxrc.s390 ]; then cat $CWD/linuxrc.s390 > sbin/init fi else if [ -f $CWD/init ]; then strip -s -o sbin/init $CWD/init fi fi (sudo find . |cpio -c -o |gzip -9) > $CWD/$TMPINITRD mv $CWD/$TMPINITRD $INITRD popd rm -rf $tmpdir