|
|
|
@ -84,6 +84,32 @@ set_kernel_version() {
|
|
|
|
|
set_param EXTRAVERSION $KV_TYPE ${KERNEL_DIR}/Makefile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get_stdin_value() {
|
|
|
|
|
sed -rn "s/^(.*\s+)?+$1=\"?([^\" ]*)\"?(\s+.*|$)/\2/p"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
change_kernel_in_grub() {
|
|
|
|
|
local ROOTDEV=$( get_stdin_value root < /proc/cmdline )
|
|
|
|
|
local NAMESUFFIX=$1
|
|
|
|
|
[[ -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
|
|
|
|
|
Treadnextline; #goto read next line
|
|
|
|
|
:changemenuitem; #else try change menuitem
|
|
|
|
|
s|root=${ROOTDEV}|&|; #if menuitem not for the system
|
|
|
|
|
Tskipmenuitem; #then skip menuitem
|
|
|
|
|
s|(/boot/vmlinuz)[^ ]+|\1-${NAMESUFFIX}|; #else change vmlinuz
|
|
|
|
|
s|initrd (.*)-install$|initrd \1/install|; #hide '-install'
|
|
|
|
|
s|(/boot/initramfs)[^ /]+|\1-${NAMESUFFIX}|; #change initramfs
|
|
|
|
|
s|/install$|-install|; #show '-install'
|
|
|
|
|
:skipmenuitem;
|
|
|
|
|
}" /boot/grub/grub.conf
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initramfs_unpack() {
|
|
|
|
|
mkdir -p tmp/initramfs ||
|
|
|
|
|
die "Catn't create temporary directory for initramfs"
|
|
|
|
@ -186,6 +212,7 @@ install_kernel() {
|
|
|
|
|
${BOOT_DIR}/initramfs-${NEW_KERNEL_VERSION}-install
|
|
|
|
|
ln -sf initramfs-${NEW_KERNEL_VERSION}-install ${BOOT_DIR}/initrd-install
|
|
|
|
|
cp ${KERNEL_DIR}/.config ${BOOT_DIR}/config-${NEW_KERNEL_VERSION}
|
|
|
|
|
change_kernel_in_grub ${NEW_KERNEL_VERSION}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KERNEL_DIR=/usr/src/linux
|
|
|
|
@ -342,11 +369,11 @@ initramfs_clean
|
|
|
|
|
initramfs_pack
|
|
|
|
|
install_kernel
|
|
|
|
|
set_new_current_kernel
|
|
|
|
|
calculate --initrd
|
|
|
|
|
/usr/calculate/install/calculate --initrd
|
|
|
|
|
if [[ "$(md5sum /boot/initrd | awk '{print $1}')" == \
|
|
|
|
|
"$(md5sum /boot/initrd-install | awk '{print $1}')" ]]
|
|
|
|
|
then
|
|
|
|
|
echo
|
|
|
|
|
echo "Perform command after reboot for optimization initramfs:"
|
|
|
|
|
echo " calculate --initrd"
|
|
|
|
|
echo " /usr/calculate/install/calculate --initrd"
|
|
|
|
|
fi
|
|
|
|
|