OBS User unknown 2007-11-30 12:30:04 +00:00 committed by Git OBS Bridge
parent ada3a3319d
commit f0751af21a
6 changed files with 137 additions and 11 deletions

View File

@ -20,7 +20,7 @@
function usage()
{
echo "Unknown or missing parameter."
echo "Usage: $0 [add|remove] <kernel-flavor> <kernel-release> <image-name> <initrd-name>"
echo "Usage: $0 [add|remove] <kernel-flavor> <kernel-release> <image-name> <initrd-name> [force-default]"
echo
echo "The old interface with 4 parameters is still supported, but deprecated."
echo "This interface will be dropped in the near future."
@ -43,13 +43,16 @@ function getargs()
image=${3} # contains the full image name, e.g. "vmlinuz-2.6.18-4-default"
initrd=${4} # contains the full initrd name, e.g. "initrd-2.6.18-4-default"
# new interface with 5 parameters
# new interface with 5 or 6 parameters, depends whether option
# "force-default" is used or not
else
action=${1} # contains the action to be executed, e.g. "add" or "remove"
flavor=${2} # contains the kernel-flavor, e.g. "default" or "xen"
release=${3} # contains the kernel-release, e.g. "2.6.18-4-default"
image=${4} # contains the full image name, e.g. "vmlinuz-2.6.18-4-default"
initrd=${5} # contains the full initrd name, e.g. "initrd-2.6.18-4-default"
forcedefault=${6} # contains action which forces corresponding boot entry beeing the
# default boot entry, enabled by given parameter "force-default"
fi
}
@ -106,6 +109,17 @@ function add_entry()
set -- ${1#xen}
opt_xen_kernel=--xen-kernel=/boot/xen${1:+-$1}.gz
if [ "$forcedefault" == "force-default" ]; then
# Add the new bootloader entry (xen kernel)
# and force it beeing the default entry
update_bootloader --image /boot/$image \
--initrd /boot/$initrd \
--default \
--force-default \
--add \
--force $opt_xen_kernel \
--name "$release"
else
# Add the new bootloader entry (xen kernel)
update_bootloader --image /boot/$image \
--initrd /boot/$initrd \
@ -113,24 +127,47 @@ function add_entry()
--add \
--force $opt_xen_kernel \
--name "$release"
fi
# Run the bootloader (e.g., lilo).
update_bootloader --refresh
;;
(debug)
if [ "$forcedefault" == "force-default" ]; then
# Add the new bootloader entry (debug kernel)
# and force it beeing the default entry
update_bootloader --image /boot/$image \
--initrd /boot/$initrd \
--force-default \
--add \
--force \
--name "$release"
else
# Add the new bootloader entry (debug kernel)
update_bootloader --image /boot/$image \
--initrd /boot/$initrd \
--add \
--force \
--name "$release"
fi
# Run the bootloader (e.g., lilo).
update_bootloader --refresh
;;
(*)
if [ "$forcedefault" == "force-default" ]; then
# Add the new bootloader entry
# and force it beeing the default entry
update_bootloader --image /boot/$image \
--initrd /boot/$initrd \
--default \
--force-default \
--add \
--force \
--name "$release"
else
# Add the new bootloader entry
update_bootloader --image /boot/$image \
--initrd /boot/$initrd \
@ -138,6 +175,7 @@ function add_entry()
--add \
--force \
--name "$release"
fi
# Run the bootloader (e.g., lilo).
update_bootloader --refresh
@ -252,7 +290,7 @@ fi
delayed_exec_file="/boot/perl-BL_delayed_exec"
# Checks if correct amount of arguments is given
if [ "$#" -ne "4" -a "$#" -ne "5" ] ; then
if [ "$#" -lt "4" -o "$#" -gt "6" ] ; then
usage
fi

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03c33078296dd092142cd3d39d8aff0e0ea0d9e10ef2743da2ab7a766afb0982
size 49363

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1cd0d26c629bb9cb88caf760178310827a389729f4b47d374728802e850cc1fc
size 49330

View File

@ -1,3 +1,49 @@
-------------------------------------------------------------------
Fri Nov 30 10:19:02 CET 2007 - aosthof@suse.de
- Prevent changing root device in kernel append line (#344447)
- Version bump to 0.4.38
-------------------------------------------------------------------
Thu Nov 15 13:31:06 CET 2007 - aosthof@suse.de
- Fixed quoting of single arguments (#276464)
- Version bump to 0.4.37
-------------------------------------------------------------------
Wed Nov 14 14:57:09 CET 2007 - aosthof@suse.de
- Reverted last patch (non existing initrd) because it's already
implemented and I've overseen it during patch session.
- Version bump to 0.4.36
-------------------------------------------------------------------
Fri Oct 19 12:58:18 CEST 2007 - aosthof@suse.de
- Moved former change to function RemoveSections(), this is the
right place
-------------------------------------------------------------------
Fri Oct 19 11:43:54 CEST 2007 - aosthof@suse.de
- detect wether there is an entry with a non existing initrd and
remove the corresponding section (#276923)
- Version bump to 0.4.35
-------------------------------------------------------------------
Fri Oct 19 11:01:24 CEST 2007 - aosthof@suse.de
- Added new parameter "force-default" to both bootloader_entry and
update-bootloader. This parameter (if used) forces the new boot
entry to be the default one (#327308)
- Version bump to 0.4.34
-------------------------------------------------------------------
Fri Oct 19 10:56:46 CEST 2007 - aosthof@suse.de
- Fixed perl warning in Core.pm (#302174)
- Version bump to 0.4.33
-------------------------------------------------------------------
Wed Sep 26 21:01:33 CEST 2007 - od@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package perl-Bootloader (Version 0.4.32)
# spec file for package perl-Bootloader (Version 0.4.38)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -11,7 +11,7 @@
# norootforbuild
Name: perl-Bootloader
Version: 0.4.32
Version: 0.4.38
Release: 1
Requires: perl >= %{perl_version}
Requires: perl-gettext
@ -64,7 +64,33 @@ install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/usr/lib/bootloader
/var/adm/perl-modules/perl-Bootloader
/sbin/update-bootloader
/usr/lib/bootloader
%changelog
* Fri Nov 30 2007 - aosthof@suse.de
- Prevent changing root device in kernel append line (#344447)
- Version bump to 0.4.38
* Thu Nov 15 2007 - aosthof@suse.de
- Fixed quoting of single arguments (#276464)
- Version bump to 0.4.37
* Wed Nov 14 2007 - aosthof@suse.de
- Reverted last patch (non existing initrd) because it's already
implemented and I've overseen it during patch session.
- Version bump to 0.4.36
* Fri Oct 19 2007 - aosthof@suse.de
- Moved former change to function RemoveSections(), this is the
right place
* Fri Oct 19 2007 - aosthof@suse.de
- detect wether there is an entry with a non existing initrd and
remove the corresponding section (#276923)
- Version bump to 0.4.35
* Fri Oct 19 2007 - aosthof@suse.de
- Added new parameter "force-default" to both bootloader_entry and
update-bootloader. This parameter (if used) forces the new boot
entry to be the default one (#327308)
- Version bump to 0.4.34
* Fri Oct 19 2007 - aosthof@suse.de
- Fixed perl warning in Core.pm (#302174)
- Version bump to 0.4.33
* Wed Sep 26 2007 - od@suse.de
- Added flag avoid_reading_device_map to Library::ReadSettings()
and to all ParseLines() (#328448)

View File

@ -8,8 +8,8 @@ use Locale::gettext;
use strict;
my %oper;
my ($opt_default, $opt_force, $opt_help, $opt_man, $opt_previous, $opt_xen)
= (0,0,0,0,0,0);
my ($opt_default, $opt_force, $opt_force_default, $opt_help, $opt_man, $opt_previous, $opt_xen)
= (0,0,0,0,0,0,0);
my ($opt_image, $opt_initrd, $opt_name, $opt_xen_name, $opt_failsafe, $opt_xen_kernel)
= ('','','','','',undef);
my $add_product = 0;
@ -26,7 +26,8 @@ update-bootloader [operation] [options]
operation is one of --add, --remove or --refresh.
valid options are --help, --man, --image <file>, --initrd <file>,
--xen-kernel <file>, --xen, --default, --previous, --name <string>, --force.
--xen-kernel <file>, --xen, --default, --previous, --name <string>, --force,
--force-default.
=head1 OPERATIONS
@ -91,6 +92,11 @@ specify the name of the section to be added/removed
dont complain, just do the right thing
=item B<--force-default>
force the new section to be added to be the default section. Only
allowed together with --add operation
=back
=head1 DESCRIPTION
@ -166,6 +172,7 @@ GetOptions (\%oper,
'refresh' ,
'remove|r' ,
'default|d' => \$opt_default,
'force-default' => \$opt_force_default,
'help|h' => \$opt_help,
'force' => \$opt_force,
'image=s' => \$opt_image,
@ -185,6 +192,9 @@ pod2usage("Specify exactly one operation, either 'add', 'remove' or 'refresh'")
pod2usage("Option 'default' is only allowed for operation 'add'")
if ($opt_default and not defined $oper{add});
pod2usage("Option 'force-default' is only allowed for operation 'add'")
if ($opt_force_default and not defined $oper{add});
if ($opt_image and $opt_image !~ m;^/;) {
$opt_image = getcwd . '/' . $opt_image
}
@ -340,6 +350,12 @@ if (defined $oper{add}) {
push @params, default => $opt_default;
}
# Else, if option $opt_force_default is set, let this new kernel be
# the default one.
elsif ($opt_force_default) {
push @params, default => $opt_default;
}
# Else, find out the flavor of the default kernel. If it is the same
# flavor as the one of the new kernel, let the new kernel be the
# default one.