blob: 7df475351f17f0adf51d91c783b322a65c3e5af7 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/bin/bash
if [ ! -f $1 ]; then
echo "$1 doesn't exist"
exit 1
fi
MNTPOINT=/tmp/updboottree.$$
INITRD=/tmp/updboottree.$$.initrd
LOOPMNT=/tmp/updboottree.$$.initrdmnt
rm -rf $MNTPOINT $LOOPMNT
mkdir $MNTPOINT $LOOPMNT
mount -o loop $1 $MNTPOINT
gunzip < $MNTPOINT/initrd.img > $INITRD
mount -o loop $INITRD $LOOPMNT
FROM=$2
TO=$FROM
if [ $(echo $FROM | cut -d- -f1) = loader ]; then
TO=loader
fi
if [ ! -x $LOOPMNT/sbin/$TO ]; then
echo "$LOOPMNT/sbin/$TO doesn't exist"
else
ls -l $LOOPMNT/sbin
install -s $FROM $LOOPMNT/sbin/$TO
ls -l $LOOPMNT/sbin
fi
umount $LOOPMNT
gzip -9 < $INITRD > $MNTPOINT/initrd.img
umount $MNTPOINT
rm -rf $MNTPOINT $LOOPMNT $INITRD
|