summaryrefslogtreecommitdiffstats
path: root/scripts/upd-initrd
blob: 8c78b2bb4482898326a4922accdd4fa742629e5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Updates an installer initrd with a new loader binary 
# Usage: upd-initrd <initrd> <binary> <outfile>
#
# CAVEATS: Must use absolute paths to files, not relative
#
# Jeremy Katz <katzj@redhat.com>
# Copyright 2005   Red Hat, Inc.

if [ $# -ne 3 ]; then
    echo "Usage: $0 <initrd> <binary> <outfile>"
    exit 1
fi

INITRD=$1
BIN=$2
OUT=$3

tmpdir=$(mktemp -d)
pushd $tmpdir
zcat $INITRD |cpio -id
strip -s -o sbin/loader $BIN
(find . |cpio -c -o |gzip -9) > $OUT
popd
rm -rf $tmpdir