ALT Linux kernel packages development
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: Anton Farygin <rider@altlinux.com>
Cc: ALT Linux kernel packages development <devel-kernel@altlinux.ru>
Subject: [d-kernel] Re: new bootloader-utils
Date: Tue, 25 May 2004 21:49:18 +0400
Message-ID: <20040525174918.GA18782@solemn.turbinal.org> (raw)
In-Reply-To: <40B158E1.6060902@altlinux.com>


[-- Attachment #1.1: Type: text/plain, Size: 1106 bytes --]

On Mon, May 24, 2004 at 06:07:29AM +0400, Anton Farygin wrote:
> >1) смотрим realpath /boot/vmlinuz, выцепляем версию текущего (старого) 
> >ядра;
> >2) делаем добавить_в_конфиги(старое_ядро) /* если его там ещё нет */;
> >3) делаем добавить_в_конфиги(новое_ядро);
> >4) делаем переставить_симлинки(новое_ядро).
> >
> >Тогда после первого по счету обновления ядра в меню появятся сразу две
> >новые записи (для старого и для нового ядра), а симлинки для дефолтной
> >записи будут смотреть на новое ядро.
> 
> Да, добро.

Остается только одна проблема: если установить к-л ядро и тут же его
удалить, то повисшие симлинки всё равно останутся.  Mike предлагает
сохранять предыдущие значения симлинков, но это опять же ничего не дает:
возможна такая комбинация установок/удалений, при которой все предыдущие
значения тоже будут смотреть вникуда.

Я уже начал было писать код типа:

OLD=`ls vmlinuz-*-* | sort -n | head -1`
if [ -e "$OLD" ]; then
	...

Но опять же получается усложнение на ровном месте...

Короче, вот так вот никому ничего в глаза не бросается?

> Rgds,
> Rider

[-- Attachment #1.2: installkernel --]
[-- Type: text/plain, Size: 3365 bytes --]

#!/bin/sh
# $Id: installkernel,v 1.2 2004/05/07 17:16:41 at Exp $
#--------------------------------------------------------------------
# Copyright (C) 2000, 2002 by MandrakeSoft,
# Chmouel Boudjnah <chmouel@mandrakesoft.com>,
# Redistribution of this file is permitted under the terms of the GNU
# Public License (GPL)
#--------------------------------------------------------------------
# Copyright (C) 2003, 2004 by ALT Linux Team,
# Alexey Tourbin <at@altlinux.org>.
#--------------------------------------------------------------------
# description: Install a kernel to /boot and add an entry for grub and lilo

: ${INSTALLKERNEL_CONFIG:=/etc/sysconfig/installkernel}
if [ -f "$INSTALLKERNEL_CONFIG" ]; then
	. "$INSTALLKERNEL_CONFIG"
fi

if [ -n "$DURING_INSTALL" ]; then
	echo "$0: DURING_INSTALL=$DURING_INSTALL; supposed to run later" 1>&2
	exit 0
fi

usage()
{
	cat <<EOF >&2
Usage: $0 [options] KERNEL_VERSION

  -n, --nolaunch	don't launch lilo;
  -R, --remove		remove bootloader entry and prepare to remove kernel;
  -m, --memtest		it's all about memtest86, not Linux kernel;
  -h, --help		this help.
EOF
	[ -n "$1" ] && exit "$1" || exit 2
}

LEGACY=algyNdsSCiLc
ARGV=`getopt -n "$0" -o nRmh$LEGACY -l nolaunch,remove,memtest,help -- "$@"` || usage
eval set -- "$ARGV"

while :; do
	case "$1" in
		-n|--nolaunch) NOLAUNCH=$1; shift
			;;
		-R|--remove) REMOVE=$1; shift
			;;
		-m|--memtest) MEMTEST=$1; shift
			;;
		-h|--help) shift; usage 0
			;;
		--) shift; break
			;;
		-[$LEGACY]) echo "$0: legacy option $1 ignored" >&2
			;;
		*) echo "$0: unrecognized option: $1" >&2; exit 1
			;;
	esac
done

VERSION="$1"
: ${BOOTDIR:=/boot}

if OLD_KERNEL=`realpath "$BOOTDIR/vmlinuz" 2>/dev/null`; then
	OLD_VERSION="${OLD_KERNEL##*/vmlinuz-}"
fi

cd "$BOOTDIR"
if [ -z "$REMOVE" -a -z "$MEMTEST" ]; then
	ln -snf "vmlinuz-$VERSION" vmlinuz
	ln -snf "initrd-$VERSION.img" initrd.img
	if [ -z "${VERSION##*-up-*}" ]; then
		ln -snf "vmlinuz-$VERSION" vmlinuz-up
		ln -snf "initrd-$VERSION.img" initrd-up.img
	fi
	if [ -z "${VERSION##*-smp-*}" ]; then
		ln -snf "vmlinuz-$VERSION" vmlinuz-smp
		ln -snf "initrd-$VERSION.img" initrd-smp.img
	fi
elif [ -z "$MEMTEST" ]; then
	rm -f "initrd-$VERSION.img"
fi
cd -

: ${LILO_CONF:=/etc/lilo.conf}
: ${GRUB_MENU_LST:=$BOOTDIR/grub/menu.lst}
: ${GRUB_DEVICE_MAP:=$BOOTDIR/grub/device.map}
: ${PERL:=/usr/bin/perl}
: ${LILO:=/sbin/lilo}
: ${DETECTLOADER:=/usr/sbin/detectloader}
: ${MKINITRD:=/sbin/mkinitrd}

# make initrd
"$MKINITRD" -f --ifneeded "$BOOTDIR/initrd-$VERSION.img" "$VERSION"

# check perl
if [ ! -x "$PERL" ]; then
	echo "$0: warning: $PERL not available; supposed to run manually..."
	PERL="echo $PERL"
fi

# modify lilo config
if [ -f "$LILO_CONF" -a -x "$sharfile/lilo" ]; then
	if [ -z "$REMOVE" -a -z "$MEMTEST" -a -n "$OLD_VERSION" ]; then
		"$PERL" "$sharfile/lilo" "$OLD_VERSION"
	fi
	"$PERL" "$sharfile/lilo" $MEMTEST $REMOVE "$VERSION"
fi

# modify grub config
if [ -f "$GRUB_MENU_LST" -a -f "$GRUB_DEVICE_MAP" -a -x "$sharfile/grub" ]; then
	if [ -z "$REMOVE" -a -z "$MEMTEST" -a -n "$OLD_VERSION" ]; then
		"$PERL" "$sharfile/grub" "$OLD_VERSION"
	fi
	"$PERL" "$sharfile/grub" $MEMTEST $REMOVE "$VERSION"
fi

# launch lilo
if [ -z "$LOADER" -a -x "$DETECTLOADER" ]; then
	LOADER=`$PERL $DETECTLOADER -q`
fi
if [ "$LOADER" = LILO -a -z "$NOLAUNCH" ]; then
	"$LILO" >/dev/null ||:
fi

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-05-25 17:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-22 14:36 [d-kernel] " Alexey Tourbin
2004-05-24  4:46 ` iLya Bryzgalow
2004-05-24  0:44   ` Anton Farygin
2004-05-25 13:18     ` [d-kernel] " Alexey Tourbin
2004-05-24  1:29       ` Anton Farygin
2004-05-25 14:09         ` Alexey Tourbin
2004-05-24  2:07           ` Anton Farygin
2004-05-25 17:49             ` Alexey Tourbin [this message]
2004-05-26  7:12               ` Denis Ovsienko
2004-05-26  8:46                 ` Anton Farygin
2004-05-26  9:06                   ` Alexey Tourbin
2004-05-26  9:46                     ` Sergey Vlasov
2004-05-31 11:36                   ` Alexey Tourbin
2004-05-31 14:00                     ` Anton Farygin
2004-05-31 14:19                       ` Alexey Tourbin
2004-05-31 14:38                         ` Sergey Vlasov
2004-05-31 14:46                         ` Sergey Vlasov
2004-06-11 14:41                 ` Alexey Tourbin
2004-06-16  7:10                   ` Denis Ovsienko
2004-05-27  8:55               ` Michael Shigorin
2004-05-25 15:18       ` Alexey Tourbin
2004-05-26  5:45       ` K.D.V.
2004-05-24  6:12   ` [d-kernel] " Александр Новосёлов
2004-05-24  6:32     ` Ivan Fedorov
2004-05-24  6:37       ` Genix
2004-05-24  6:41         ` Ivan Fedorov
2004-05-24  7:32       ` Александр Новосёлов
2004-05-24  7:36       ` Michael Shigorin
2004-05-24  7:35     ` Michael Shigorin
2004-05-24  7:32 ` Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040525174918.GA18782@solemn.turbinal.org \
    --to=at@altlinux.ru \
    --cc=devel-kernel@altlinux.ru \
    --cc=rider@altlinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git