OBS User unknown 2007-09-21 13:46:46 +00:00 committed by Git OBS Bridge
parent 95db5acfad
commit 3f07f13c13
6 changed files with 128 additions and 52 deletions

View File

@ -57,11 +57,12 @@ function getargs()
# Wrapper for the update-bootloader function # Wrapper for the update-bootloader function
function update_bootloader() function update_bootloader()
{ {
echo "bootloader_entry: This is (wrapper) function update_bootloader" >> \ echo "bootloader_entry: This is (wrapper) function update_bootloader" >> $logname
/var/log/YaST2/perl-BL-standalone-log
[ -x /sbin/update-bootloader ] || return 0 [ -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() function add_entry()
{ {
echo "bootloader_entry: This is function add_entry()" >> \ echo "bootloader_entry: This is function add_entry()" >> $logname
/var/log/YaST2/perl-BL-standalone-log
# Set up the new kernel # Set up the new kernel
if [ -f /etc/sysconfig/bootloader ] && if [ -f /etc/sysconfig/bootloader ] &&
@ -134,6 +134,28 @@ function add_entry()
####################################### #######################################
function remove_entry() function remove_entry()
{ {
echo "bootloader_entry: This is function remove_entry()" >> $logname
# 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 [ "$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
# Do not specify the name of a bootloader entry when removing it, thus # Do not specify the name of a bootloader entry when removing it, thus
# removing all sections matching the kernel image and initrd names # removing all sections matching the kernel image and initrd names
# (either both a "linux" and a "failsafe" section, or a section # (either both a "linux" and a "failsafe" section, or a section
@ -153,10 +175,8 @@ function remove_entry()
# sections at all, or do only chainload them (BootLILO.ycp), and # sections at all, or do only chainload them (BootLILO.ycp), and
# thus do not match either. (#223030) # thus do not match either. (#223030)
echo "bootloader_entry: This is function remove_entry()" >> \
/var/log/YaST2/perl-BL-standalone-log
if [ $flavor == "xen" ]; then if [ "$flavor" == "xen" ]; then
update_bootloader --image /boot/$image \ update_bootloader --image /boot/$image \
--initrd /boot/$initrd \ --initrd /boot/$initrd \
--xen \ --xen \
@ -171,12 +191,31 @@ function remove_entry()
# Run the bootloader (e.g., lilo). # Run the bootloader (e.g., lilo).
update_bootloader --refresh update_bootloader --refresh
fi
} }
##################### M A I N ############################################### ##################### 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 # Checks if correct amount of arguments is given
if [ "$#" -ne "4" -a "$#" -ne "5" ] ; then if [ "$#" -ne "4" -a "$#" -ne "5" ] ; then
@ -194,7 +233,7 @@ case $action in
;; ;;
remove) remove)
# Remove an existing bootloader entry # Remove an existing bootloader entry
remove_entry remove_entry "$@"
;; ;;
*) *)
# Unknown argument # Unknown argument

View File

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

View File

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

View File

@ -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 Tue Sep 18 20:56:03 CEST 2007 - aosthof@suse.de

View File

@ -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. # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine # This file and all modifications and additions to the pristine
@ -11,7 +11,7 @@
# norootforbuild # norootforbuild
Name: perl-Bootloader Name: perl-Bootloader
Version: 0.4.29 Version: 0.4.30
Release: 1 Release: 1
Requires: perl >= %{perl_version} Requires: perl >= %{perl_version}
Requires: perl-gettext Requires: perl-gettext
@ -64,8 +64,15 @@ install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/usr/lib/bootloader
/var/adm/perl-modules/perl-Bootloader /var/adm/perl-modules/perl-Bootloader
/sbin/update-bootloader /sbin/update-bootloader
/usr/lib/bootloader /usr/lib/bootloader
%changelog %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 * Tue Sep 18 2007 - aosthof@suse.de
- Added more verbose logging to update-bootloader and - Added more verbose logging to update-bootloader and
bootloader_entry to be able to better analyze occurring bootloader_entry to be able to better analyze occurring

View File

@ -156,6 +156,10 @@ sub GetProduct {
return "Linux"; 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, GetOptions (\%oper,
'add|a' , 'add|a' ,
@ -311,7 +315,7 @@ if (defined $oper{add}) {
# execute selected operation # execute selected operation
# #
if (defined $oper{add}) { 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"); print LOG ("update-bootloader: now executing operation add\n");
close LOG; close LOG;
@ -355,7 +359,7 @@ if (defined $oper{add}) {
# Add original_name to params to be able to create comment line # Add original_name to params to be able to create comment line
push @params, original_name => "xen"; 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"); print LOG ("update-bootloader: calling Tools::AddSection (XEN)\n");
close LOG; close LOG;
@ -366,7 +370,7 @@ if (defined $oper{add}) {
# Add original_name to params to be able to create comment line # Add original_name to params to be able to create comment line
push @params, original_name => "linux"; 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"); print LOG ("update-bootloader: calling Tools::AddSection (normal)\n");
close LOG; close LOG;
@ -389,7 +393,7 @@ if (defined $oper{add}) {
# Add original_name to params to be able to create comment line # Add original_name to params to be able to create comment line
push @params, original_name => "failsafe"; 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"); print LOG ("update-bootloader: calling Tools::AddSection (failsafe)\n");
close LOG; close LOG;
@ -407,7 +411,7 @@ if (defined $oper{remove}) {
push @params, initrd => $opt_initrd if $opt_initrd; push @params, initrd => $opt_initrd if $opt_initrd;
push @params, name => $opt_name if $opt_name; 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"); print LOG ("update-bootloader: now executing operation remove\n");
close LOG; close LOG;
@ -415,17 +419,29 @@ if (defined $oper{remove}) {
if ($num > 0) { if ($num > 0) {
if ($num > 1 and not $opt_force) { 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'"); pod2usage("There is more than one section with image '$opt_image'");
} else { } else {
open (LOG, ">>/var/log/YaST2/perl-BL-standalone-log"); open (LOG, ">>$logname");
print LOG ("update-bootloader: calling Tools::RemoveSections\n"); print LOG ("update-bootloader: calling Tools::RemoveSections\n");
close LOG; close LOG;
RemoveSections(@params); 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'"); 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}) { if (defined $oper{refresh}) {