This commit is contained in:
parent
95db5acfad
commit
3f07f13c13
117
bootloader_entry
117
bootloader_entry
@ -57,11 +57,12 @@ function getargs()
|
||||
# Wrapper for the update-bootloader function
|
||||
function update_bootloader()
|
||||
{
|
||||
echo "bootloader_entry: This is (wrapper) function update_bootloader" >> \
|
||||
/var/log/YaST2/perl-BL-standalone-log
|
||||
echo "bootloader_entry: This is (wrapper) function update_bootloader" >> $logname
|
||||
|
||||
[ -x /sbin/update-bootloader ] || return 0
|
||||
/sbin/update-bootloader "$@"
|
||||
# call update-bootloader and also append stderr to the log file
|
||||
((/sbin/update-bootloader "$@") 3>&1 1>&2 2>&3 3>&- | tee -a \
|
||||
$logname ) 3>&1 1>&2 2>&3 3>&-
|
||||
}
|
||||
|
||||
|
||||
@ -70,8 +71,7 @@ function update_bootloader()
|
||||
##############################
|
||||
function add_entry()
|
||||
{
|
||||
echo "bootloader_entry: This is function add_entry()" >> \
|
||||
/var/log/YaST2/perl-BL-standalone-log
|
||||
echo "bootloader_entry: This is function add_entry()" >> $logname
|
||||
|
||||
# Set up the new kernel
|
||||
if [ -f /etc/sysconfig/bootloader ] &&
|
||||
@ -134,49 +134,88 @@ function add_entry()
|
||||
#######################################
|
||||
function remove_entry()
|
||||
{
|
||||
# Do not specify the name of a bootloader entry when removing it, thus
|
||||
# removing all sections matching the kernel image and initrd names
|
||||
# (either both a "linux" and a "failsafe" section, or a section
|
||||
# installed with the kernel postinstall script).
|
||||
#
|
||||
# Rationale: we do not know whether the old entry has
|
||||
# - the product name as its name (when installed with
|
||||
# yast-bootloader) or
|
||||
# - "Kernel-<version>" (when installed with the kernel package's
|
||||
# postinstall script and perl-Bootloader).
|
||||
#
|
||||
# So we cannot use the name to find the correct section.
|
||||
# This is safe, because on grub, this does still not match other
|
||||
# sections on other partitions with the same name for the kernel
|
||||
# image and initrd (because they will still have the (hdx,y) prefix
|
||||
# in perl-Bootloader). Other bootloaders do not specify other
|
||||
# sections at all, or do only chainload them (BootLILO.ycp), and
|
||||
# thus do not match either. (#223030)
|
||||
echo "bootloader_entry: This is function remove_entry()" >> $logname
|
||||
|
||||
echo "bootloader_entry: This is function remove_entry()" >> \
|
||||
/var/log/YaST2/perl-BL-standalone-log
|
||||
# If running in instsys, write command(s) to be executed in a file
|
||||
# which will be executed by yast2-bootloader after installation of
|
||||
# packages is finished.
|
||||
#
|
||||
# This is to prevent inconsistencies triggered by libata merge.
|
||||
|
||||
if [ $flavor == "xen" ]; then
|
||||
update_bootloader --image /boot/$image \
|
||||
--initrd /boot/$initrd \
|
||||
--xen \
|
||||
--remove \
|
||||
--force
|
||||
if [ "$YAST_IS_RUNNING" == instsys -a "$DELAYED_RUN_UPDATE_BOOTLOADER" != yes ]; then
|
||||
delayed_exec_file="/boot/perl-BL_delayed_exec"
|
||||
|
||||
cat - >> $delayed_exec_file <<-EOF
|
||||
#!/bin/sh
|
||||
|
||||
export DELAYED_RUN_UPDATE_BOOTLOADER=yes
|
||||
|
||||
/usr/lib/bootloader/bootloader_entry $@
|
||||
|
||||
EOF
|
||||
|
||||
chmod 755 $delayed_exec_file
|
||||
else
|
||||
update_bootloader --image /boot/$image \
|
||||
--initrd /boot/$initrd \
|
||||
--remove \
|
||||
--force
|
||||
fi
|
||||
# Do not specify the name of a bootloader entry when removing it, thus
|
||||
# removing all sections matching the kernel image and initrd names
|
||||
# (either both a "linux" and a "failsafe" section, or a section
|
||||
# installed with the kernel postinstall script).
|
||||
#
|
||||
# Rationale: we do not know whether the old entry has
|
||||
# - the product name as its name (when installed with
|
||||
# yast-bootloader) or
|
||||
# - "Kernel-<version>" (when installed with the kernel package's
|
||||
# postinstall script and perl-Bootloader).
|
||||
#
|
||||
# So we cannot use the name to find the correct section.
|
||||
# This is safe, because on grub, this does still not match other
|
||||
# sections on other partitions with the same name for the kernel
|
||||
# image and initrd (because they will still have the (hdx,y) prefix
|
||||
# in perl-Bootloader). Other bootloaders do not specify other
|
||||
# sections at all, or do only chainload them (BootLILO.ycp), and
|
||||
# thus do not match either. (#223030)
|
||||
|
||||
# Run the bootloader (e.g., lilo).
|
||||
update_bootloader --refresh
|
||||
|
||||
if [ "$flavor" == "xen" ]; then
|
||||
update_bootloader --image /boot/$image \
|
||||
--initrd /boot/$initrd \
|
||||
--xen \
|
||||
--remove \
|
||||
--force
|
||||
else
|
||||
update_bootloader --image /boot/$image \
|
||||
--initrd /boot/$initrd \
|
||||
--remove \
|
||||
--force
|
||||
fi
|
||||
|
||||
# Run the bootloader (e.g., lilo).
|
||||
update_bootloader --refresh
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
##################### M A I N ###############################################
|
||||
|
||||
# Log how program was called
|
||||
logname="/var/log/YaST2/perl-BL-standalone-log"
|
||||
echo "bootloader_entry was called as: $*" >> $logname
|
||||
|
||||
# Log parts of the current system configuration
|
||||
(
|
||||
echo "/proc/mounts:"
|
||||
cat /proc/mounts
|
||||
echo "/sys:"
|
||||
ls -l /sys
|
||||
echo "excerpts of /dev:"
|
||||
ls -l /dev/{[hs]d[ab]?,md[0-3],.udev}
|
||||
device_map="/boot/grub/device.map"
|
||||
if [ -e $device_map ] ; then
|
||||
echo "device.map:"
|
||||
cat $device_map
|
||||
fi
|
||||
) >> $logname
|
||||
|
||||
# Checks if correct amount of arguments is given
|
||||
if [ "$#" -ne "4" -a "$#" -ne "5" ] ; then
|
||||
@ -194,7 +233,7 @@ case $action in
|
||||
;;
|
||||
remove)
|
||||
# Remove an existing bootloader entry
|
||||
remove_entry
|
||||
remove_entry "$@"
|
||||
;;
|
||||
*)
|
||||
# Unknown argument
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c404ca3128aedce184bc276522eeec0cf17b93da1fd7ba22feb7fee5355d5df9
|
||||
size 48824
|
3
perl-Bootloader-0.4.30.tar.bz2
Normal file
3
perl-Bootloader-0.4.30.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4292b09e730694e3c976a6abe68678dd328c52f50bb390462423ed9bd2c7ebf6
|
||||
size 49168
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Sep 21 15:13:09 CEST 2007 - aosthof@suse.de
|
||||
|
||||
- Save command for removal of old sections in
|
||||
/boot/perl-BL_delayed_exec for delayed execution in the target
|
||||
system, script will be run by yast2-bootloader after installation
|
||||
of packages is finished (#309837)
|
||||
- Version bump to 0.4.30
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 19 21:55:09 CEST 2007 - aosthof@suse.de
|
||||
|
||||
- Again added more logging - also related to #309837
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 18 20:56:03 CEST 2007 - aosthof@suse.de
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package perl-Bootloader (Version 0.4.29)
|
||||
# spec file for package perl-Bootloader (Version 0.4.30)
|
||||
#
|
||||
# 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.29
|
||||
Version: 0.4.30
|
||||
Release: 1
|
||||
Requires: perl >= %{perl_version}
|
||||
Requires: perl-gettext
|
||||
@ -64,8 +64,15 @@ install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/usr/lib/bootloader
|
||||
/var/adm/perl-modules/perl-Bootloader
|
||||
/sbin/update-bootloader
|
||||
/usr/lib/bootloader
|
||||
|
||||
%changelog
|
||||
* Fri Sep 21 2007 - aosthof@suse.de
|
||||
- Save command for removal of old sections in
|
||||
/boot/perl-BL_delayed_exec for delayed execution in the target
|
||||
system, script will be run by yast2-bootloader after installation
|
||||
of packages is finished (#309837)
|
||||
- Version bump to 0.4.30
|
||||
* Wed Sep 19 2007 - aosthof@suse.de
|
||||
- Again added more logging - also related to #309837
|
||||
* Tue Sep 18 2007 - aosthof@suse.de
|
||||
- Added more verbose logging to update-bootloader and
|
||||
bootloader_entry to be able to better analyze occurring
|
||||
|
@ -156,6 +156,10 @@ sub GetProduct {
|
||||
return "Linux";
|
||||
}
|
||||
|
||||
my $logname = "/var/log/YaST2/perl-BL-standalone-log";
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader called:\n" . $0 . " " . join (" ", @ARGV) . "\n");
|
||||
close LOG;
|
||||
|
||||
GetOptions (\%oper,
|
||||
'add|a' ,
|
||||
@ -311,7 +315,7 @@ if (defined $oper{add}) {
|
||||
# execute selected operation
|
||||
#
|
||||
if (defined $oper{add}) {
|
||||
open (LOG, ">>/var/log/YaST2/perl-BL-standalone-log");
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: now executing operation add\n");
|
||||
close LOG;
|
||||
|
||||
@ -355,7 +359,7 @@ if (defined $oper{add}) {
|
||||
# Add original_name to params to be able to create comment line
|
||||
push @params, original_name => "xen";
|
||||
|
||||
open (LOG, ">>/var/log/YaST2/perl-BL-standalone-log");
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: calling Tools::AddSection (XEN)\n");
|
||||
close LOG;
|
||||
|
||||
@ -366,7 +370,7 @@ if (defined $oper{add}) {
|
||||
# Add original_name to params to be able to create comment line
|
||||
push @params, original_name => "linux";
|
||||
|
||||
open (LOG, ">>/var/log/YaST2/perl-BL-standalone-log");
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: calling Tools::AddSection (normal)\n");
|
||||
close LOG;
|
||||
|
||||
@ -389,7 +393,7 @@ if (defined $oper{add}) {
|
||||
# Add original_name to params to be able to create comment line
|
||||
push @params, original_name => "failsafe";
|
||||
|
||||
open (LOG, ">>/var/log/YaST2/perl-BL-standalone-log");
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: calling Tools::AddSection (failsafe)\n");
|
||||
close LOG;
|
||||
|
||||
@ -407,7 +411,7 @@ if (defined $oper{remove}) {
|
||||
push @params, initrd => $opt_initrd if $opt_initrd;
|
||||
push @params, name => $opt_name if $opt_name;
|
||||
|
||||
open (LOG, ">>/var/log/YaST2/perl-BL-standalone-log");
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: now executing operation remove\n");
|
||||
close LOG;
|
||||
|
||||
@ -415,17 +419,29 @@ if (defined $oper{remove}) {
|
||||
|
||||
if ($num > 0) {
|
||||
if ($num > 1 and not $opt_force) {
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: found $num sections, no opt_force: not removing\n");
|
||||
close LOG;
|
||||
|
||||
pod2usage("There is more than one section with image '$opt_image'");
|
||||
} else {
|
||||
open (LOG, ">>/var/log/YaST2/perl-BL-standalone-log");
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: calling Tools::RemoveSections\n");
|
||||
close LOG;
|
||||
|
||||
RemoveSections(@params);
|
||||
}
|
||||
} elsif (not $opt_force) {
|
||||
} else {
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: no $opt_image found\n");
|
||||
close LOG;
|
||||
|
||||
pod2usage("There is no section with image '$opt_image'");
|
||||
}
|
||||
open (LOG, ">>$logname");
|
||||
print LOG ("update-bootloader: finished operation remove\n");
|
||||
close LOG;
|
||||
|
||||
}
|
||||
|
||||
if (defined $oper{refresh}) {
|
||||
|
Loading…
Reference in New Issue
Block a user