Fix update initramfs in calculate and calculate-kernel eclasses.

Added check file exists.
master
Mike Hiretsky 14 years ago
parent 77110e700a
commit 91ed432dc4

@ -150,6 +150,7 @@ change_kernel_in_grub() {
[[ -f /boot/vmlinuz-${NAMESUFFIX} ]] &&
[[ -f /boot/initramfs-${NAMESUFFIX} ]] &&
[[ -f /boot/initramfs-${NAMESUFFIX}-install ]] &&
[[ -f /boot/grub/grub.conf ]] &&
sed -ri "/^title/{ #find title in grub.conf
:readnextline;N; #read next line
s/\ninitrd/&/; #if pattern not contents initrd

@ -392,15 +392,26 @@ calculate_change_version() {
calculate_get_current_initrd() {
calculate_initvars
local suffix=$1
sed -nr "/^title/{ #find title in grub.conf
:readnextline;N; #read next line
s/\ninitrd/&/; #if pattern not contents initrd
Treadnextline; #goto read next line
s|root=${ROOTDEV}.*initrd.*${suffix}|&|; #if menuitem not for this system
Tskipmenuitem; #then skip menuitem
s|^.*initrd (.*)$|\1|p; #display initramfs
q;
:skipmenuitem;
d;
}" /boot/grub/grub.conf
if [[ -f /boot/grub/grub.conf ]]
then
filename=$(sed -nr "/^title/{ #find title in grub.conf
:readnextline;N; #read next line
s/\ninitrd/&/; #if pattern not contents initrd
Treadnextline; #goto read next line
s|root=${ROOTDEV}.*initrd.*${suffix}|&|; #if menuitem not for this system
Tskipmenuitem; #then skip menuitem
s|^.*initrd (.*)$|\1|p; #display initramfs
q;
:skipmenuitem;
d;
}" /boot/grub/grub.conf)
if [[ -z $filename ]]
then
echo "/boot/initrd${suffix}"
else
echo $filename
fi
else
echo "/boot/initrd${suffix}"
fi
}

Loading…
Cancel
Save