pax_global_header00006660000000000000000000000064122436421520014513gustar00rootroot0000000000000052 comment=fd804542e86da8dd919e82f45983b7f3aa7ad992 bootloader-utils-0.4.23.1-alt1/000075500000000000000000000000001224364215200160655ustar00rootroot00000000000000bootloader-utils-0.4.23.1-alt1/.gear-rules000064400000000000000000000000611224364215200201310ustar00rootroot00000000000000tar: . name=bootloader-utils-@version@-@release@ bootloader-utils-0.4.23.1-alt1/FILES000064400000000000000000000002351224364215200166520ustar00rootroot00000000000000bootloader_utils.pm bootloader-utils.spec convertdev.sh detectliloboot.sh detectloader.sh FILES grub installkernel lilo Makefile rebootin rebootin.8 test.pl bootloader-utils-0.4.23.1-alt1/Makefile000064400000000000000000000020331224364215200175230ustar00rootroot00000000000000NAME = bootloader-utils FILES = $(shell cat FILES) root = $(RPM_BUILD_ROOT) prefix = $(root)/usr sbindir = $(prefix)/sbin datadir = $(prefix)/share mandir = $(prefix)/share/man perl_libdir = $(root)$(shell eval `perl -V:installsitelib`; echo $$installsitelib) INSTALL = install -p all: build test: perl test.pl install: $(INSTALL) -d $(sbindir) $(datadir) $(mandir)/man8 $(perl_libdir) $(root)/sbin $(datadir)/loader $(INSTALL) -m644 *.pm $(perl_libdir) $(INSTALL) -m644 *.8 $(mandir)/man8 $(INSTALL) -m755 lilo grub $(datadir)/loader $(INSTALL) -m755 convertdev.sh $(sbindir) $(INSTALL) -m755 detectloader.sh $(sbindir) $(INSTALL) -m755 detectliloboot.sh $(sbindir) $(INSTALL) -m755 rebootin $(sbindir) $(INSTALL) -m755 installkernel $(root)/sbin tar $(NAME).tar.gz: $(FILES) mkdir $(NAME) ; \ tar cf - `cat FILES` | ( cd $(NAME) ; tar xfBp - ) ; \ tar cf $(NAME).tar $(NAME) ; \ rm -rf $(NAME) ; \ gzip -9f $(NAME).tar rpm: $(NAME).tar.gz rpm -ta $(NAME).tar.gz clean: rm -fv *[~-] .PHONY: all build install tar rpm clean bootloader-utils-0.4.23.1-alt1/bootloader-utils.spec000064400000000000000000000245521224364215200222410ustar00rootroot00000000000000Name: bootloader-utils Version: 0.4.23.1 Release: alt1 Summary: Bootloader utilities License: GPL Group: System/Base BuildArch: noarch Source: %name-%version-%release.tar PreReq: getopt, make-initrd >= 0.4.3-alt2 Conflicts: grub2 < 1.98-alt13 Conflicts: lilo < 22.7.3-alt7 %ifarch %arm PreReq: uboot-tools >= 2013.07 %endif # Automatically added by buildreq on Thu Feb 22 2007 BuildRequires: perl-devel %description This package contains utilities used to manipulate bootloaders. %prep %setup -n %name-%version-%release %build %make_build %install %makeinstall perl_libdir=%buildroot%perl_vendor_privlib ln -s `relative %perl_vendor_privlib/bootloader_utils.pm %_datadir/loader/bootloader_utils.pm` \ %buildroot%_datadir/loader/bootloader_utils.pm mkdir -p %buildroot/%_rpmlibdir install -pD -m755 kernel.filetrigger %buildroot/%_rpmlibdir/boot_kernel.filetrigger mkdir -p %buildroot/%_sysconfdir/sysconfig cat > %buildroot/%_sysconfdir/sysconfig/installkernel <<-EOF INITRD_GENERATOR=make-initrd MKINITRD=%_sbindir/mkinitrd-make-initrd #INITRD_AUTOUPDATE=all EOF %check make test %pre [ $1 -gt 1 ] || exit 0 f=/etc/sysconfig/installkernel rm -f $f.install [ ! -f $f ] || exit 0 if [ -f $f.rpmsave ]; then cp -a $f.rpmsave $f.install else cat >&2 < /dev/null ||: mv $f.install $f %files %config(noreplace) %_sysconfdir/sysconfig/installkernel /sbin/installkernel %_sbindir/detectloader.sh %_sbindir/detectliloboot.sh %_sbindir/convertdev.sh %_sbindir/rebootin %_datadir/loader/ %perl_vendor_privlib/*.pm %_man8dir/*.* %_rpmlibdir/*.filetrigger %changelog * Fri Nov 22 2013 Gleb F-Malinovskiy 0.4.23.1-alt1 - installkernel: use trap for temp files (tnx ldv@). - UBOOT_INITRD_LOAD_ADDRESS is optional. * Wed Nov 20 2013 Gleb F-Malinovskiy 0.4.23-alt1 - installkernel: append dtb to multiplatform kernels. * Tue Jul 09 2013 Gleb F-Malinovskiy 0.4.22-alt1 - Add support of uboot. * Sun Apr 07 2013 Dmitry V. Levin 0.4.21-alt1 - kernel.filetrigger: fixed handling of uninstalled kernels (by Roman Savochenko; closes: #28647). * Wed Mar 13 2013 Anton V. Boyarshinov 0.4.20-alt1 - installkernel: stop if initrd creation failed * Thu Jan 31 2013 Michael Shigorin 0.4.19-alt1 - installkernel: don't install memtest* in EFI mode (won't boot) * Thu Dec 13 2012 Gleb F-Malinovskiy 0.4.18-alt1 - lilo: fix regression introdused by 0.4.15-alt1 * Thu Dec 06 2012 Dmitry V. Levin 0.4.17-alt1 - kernel.filetrigger: added handling of kernel modules, obsoletes %%post_kernel_modules and %%postun_kernel_modules. * Wed Dec 05 2012 Dmitry V. Levin 0.4.16-alt1 - installkernel: run depmod only when installing a kernel. * Sun Nov 04 2012 Led 0.4.15-alt1 - lilo: don't strip label - conflicts lilo < 22.7.3-alt7 * Thu Oct 20 2011 Anton Protopopov 0.4.14-alt1 - installkernel: run depmod before creating initrd * Wed Jul 27 2011 Anton V. Boyarshinov 0.4.13-alt1 - support for 3.x kernels added * Sun Dec 12 2010 Dmitry V. Levin 0.4.12-alt1 - %%pre: when neither /etc/sysconfig/installkernel nor /etc/sysconfig/installkernel.rpmsave exists, assume that system was configured to use make-initrd (closes: #24739), and issue a warning for mkinitrd users. * Fri Dec 10 2010 Dmitry V. Levin 0.4.11-alt1 - boot_kernel.filetrigger: cleanup, do nothing when either /proc or /sys is not mounted. * Wed Dec 08 2010 Vitaly Kuznetsov 0.4.10-alt3 - fix options handling bug in installkernel introduced in 0.4.10-alt1 - implement INITRD_AUTOUPDATE={all,default,none} option for automatic ramdisks update on kernel install/removal - set default INITRD_AUTOUPDATE value to 'none' * Tue Dec 07 2010 Vitaly Kuznetsov 0.4.10-alt2 - Fixed /etc/sysconfig/installkernel migration issues (ALT #24709): + do not switch from mkinitrd to make-initrd if make-initrd was not enabled before the update; + inherit locally modified config left after make-initrd update * Tue Dec 07 2010 Vitaly Kuznetsov 0.4.10-alt1 - introduce NODEFAULT,NOFLAVOUR and KEEPINITRD options for installkernel - add make-initrd dependency - add /etc/sysconfig/installkernel from make-initrd * Mon Nov 29 2010 Vitaly Kuznetsov 0.4.9-alt2 - ldv@: minor filetrigger patch * Thu Nov 25 2010 Vitaly Kuznetsov 0.4.9-alt1 - implement filetrigger for kernel update * Mon Nov 08 2010 Vitaly Kuznetsov 0.4.8-alt4 - rider@: add grub2 support to detectloader.sh * Thu Sep 30 2010 Vitaly Kuznetsov 0.4.8-alt3 - Remove redundant vmlinuz-smp,vmlinuz-up,initrd-smp.img,initrd-up.img links creation - raorn@: add EXTLINUX support (ALT #24154) - zerg@: create /boot/vmlinuz-{kflavour} links (ALT #24145) * Fri Jun 04 2010 Vitaly Kuznetsov 0.4.8-alt2 - Remove grub-mkconfig call from installkernel (moved to filetrigger) - (ALT #23333) * Wed Feb 24 2010 Alexey Gladkov 0.4.8-alt1 - Add make-initrd support. * Mon Jan 18 2010 Anton V. Boyarshinov 0.4.7-alt1 - grub2 support * Sat Jan 09 2010 Vladislav Zavjalov 0.4.6-alt1 - lilo: - protect quotes in lilo.conf values (closes: #22705); - remove spaces from labels - bootloader_utils.pm: cleanup code of getroot() * Fri Dec 11 2009 Vladislav Zavjalov 0.4.5-alt1 - detectliloboot.sh: return real boot device when raid-extra-boot is set to mbr-only * Tue Oct 13 2009 Vladislav Zavjalov 0.4.4-alt1 - installkernel: improve error messages (closes: #21914) * Mon Oct 05 2009 Vladislav Zavjalov 0.4.3-alt1 - add convertdev.sh script to convert UUID=.. or LABEL=.. to device names use it in detectliloboot.sh and grub scripts (closes #18127) - bootloader_utils.pm: mnt2dev(): don't use mtab to convert device names * Mon Sep 21 2009 Vladislav Zavjalov 0.4.2-alt1 - add --label option to installkernel, lilo and grub scripts * Wed Sep 16 2009 Vladislav Zavjalov 0.4.1-alt1 - installkernel: - change lilo restarting logic (closes #1014, #1015, #20695): old behaviour: restart lilo if first bootloader found in devices from /proc/partitions is lilo new one: restart lilo when lilo bootloader is found in device from boot= setting in lilo.conf - when detectliloboot.sh fails to find device, there are no need to run detectloader.sh (thx Dmitry V. Levin) (closes: #21106) - suppress unwanted output from cd - - detectloader: replace by two shell scripts: detectliloboot.sh -- to get boot device from lilo.conf detectloader.sh -- to get bootloader type on the given device or file - bootloader_utils.pm: - (getroot): recognize UUID and LABEL (thx Dmitry V. Levin) (closes: #2194, #18127) - remove unused functions (partitions, typeOfMBR) used in removed detectloader program - rebootin - remove GRUB support - fix working with quoted labels in lilo.conf (closes: #11446). - cleanup code, improve error and help messages - add long options, add -l option for listing available labels. - update manpage - remove URL and Packager tags (thx Dmitry V. Levin). * Fri Mar 07 2008 Dmitry V. Levin 0.3.3-alt1 - grub: Fixed memtest removal (Alexey Tourbin). - installkernel: + Do not discard /sbin/lilo stdout (Alexey Tourbin). + Do not run detectloader in nolaunch mode. + Do not invoke "cp" by absolute pathname. + Do not touch files in DURING_INSTALL mode, thus reverting the change made in 0.3.1-alt2. + Replaced non-portable "realpath" with "readlink -e". + Fixed xen kernels install (Aleksey Avdeev, #13672). * Thu Feb 22 2007 Alexey Tourbin 0.3.2-alt1 - fixed accidental Windows(tm) removal from lilo.conf (#6102) - fixed lilo.conf quoting issues (#10903) * Mon Feb 12 2007 Alexey Gladkov 0.3.1-alt2 - Update symlinks in /boot if DURING_INSTALL specified. * Fri Feb 09 2007 Alexey Gladkov 0.3.1-alt1.1.1 - NMU: - quote lilo parameters. * Thu Feb 09 2006 Anton Farygin 0.3.1-alt1.1 - NMU: - fstab parser fixes (#3318, #8615) - installkernel fixes (#4811, #7386) * Tue Aug 17 2004 Alexey Tourbin 0.3.1-alt1 - fixed skiplist processing (Sergey Vlasov, #4254) - create backup (.old) copies of lilo.conf and grub/menu.lst (#4395) - installkernel: run mkinitrd(8) without --ifneeded (should hopefully fix #4234 and #4643) * Fri Jun 11 2004 Alexey Tourbin 0.3-alt1 - added support for LABEL and UUID volumes (via /etc/mtab) - installkernel: save entry for /boot/vmlinuz before upgrade - installkernel: added support for memtest86 - grub: fix for separate /boot partition, by Sergey Vlasov (#4234) - started test suite (test.pl) * Fri May 07 2004 Alexey Tourbin 0.2-alt1 - here goes my first major revision; highlights: + common.pm -> bootloader_utils.pm, reworked + detectloader(1) reworked + helpers for lilo(1) and grub(1) configuration files reworked + installkernel reworked, /etc/sysconfig/installkernel disappeared * Wed Mar 19 2003 Peter Novodvorsky 0.1-alt7 - Updated label shorten algorithm in lilo installer script. * Mon Dec 09 2002 Dmitry V. Levin 0.1-alt6 - Fixed perl dependencies (#0001679). * Fri Nov 15 2002 Stanislav Ievlev 0.1-alt5 - rebuild - more features: + skiplist for mhz (#0001015) + advanced skiping of cdroms (#0001014) * Fri Mar 15 2002 Dmitry V. Levin 0.1-alt4 - Fixed configuration options parsing (imz, #0000507). * Thu Feb 14 2002 Stanislav Ievlev 0.1-alt3 - added new signature for the GRUB * Fri Nov 23 2001 Dmitry V. Levin 0.1-alt2 - Added %%build section, autogenerated buildrequires. * Wed Nov 14 2001 Dmitry V. Levin 0.1-alt1 - Imported MDK code (to be rewritten). bootloader-utils-0.4.23.1-alt1/bootloader_utils.pm000064400000000000000000000027751224364215200220100ustar00rootroot00000000000000package bootloader_utils; # $Id: bootloader_utils.pm,v 1.4 2004/06/11 11:09:45 at Exp $ #-------------------------------------------------------------------- # Copyright (C) 2000, 2001, 2002 by MandrakeSoft. # Chmouel Boudjnah . # # Redistribution of this file is permitted under the terms of the GNU # Public License (GPL) #-------------------------------------------------------------------- # Copyright (C) 2003 by ALT Linux Team, # Alexey Tourbin . #-------------------------------------------------------------------- require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(mnt2dev getroot); use strict; sub gettab ($) { my $fname = shift; open my $fh, $fname or do { warn "$0: $fname: $!"; return; }; my @tab; local $_; local $/ = "\n"; while (<$fh>) { next unless /\S/; next if /^\s*#/; my @ent = split; push @tab, \@ent; } return @tab; } sub mnt2dev ($;$) { my $mnt = shift; my $fstab_file = shift || "/etc/fstab"; my @fstab = gettab $fstab_file; foreach my $fsent (@fstab) { return $$fsent[0] if $$fsent[1] eq $mnt; } return; } sub getroot { my $root; # 1. try to get root device from /proc/cmdline my $fh; if ((open $fh, "/proc/cmdline") && (<$fh> =~ /root=((UUID=|LABEL=|\/)\S+)/)){ $root=$1; } # 2. try to get root device from /etc/fstab $root = mnt2dev("/") unless $root; # 3. try to get root device from /usr/sbin/rdev $root=$& if !$root && (`/usr/sbin/rdev` =~ /\/\S+/); return $root; } 1; bootloader-utils-0.4.23.1-alt1/convertdev.sh000075500000000000000000000010661224364215200206060ustar00rootroot00000000000000#!/bin/sh -efu . shell-args show_help() { cat <<-EOF convertdev.sh - convert UUID=... or LABEL=... or /dev/disk/by-... device representations into device names. Usage: $PROG EOF exit } [ "$#" = 1 ] && [ "$1" != '-h' ] || show_help dev="$1" if [ "${dev#UUID=}" != "$dev" -o "${dev#LABEL=}" != "$dev" ]; then /sbin/blkid -t "$dev" | cut -f1 -d: | while read dev; do [ -b "$dev" ] || continue printf "%s\n" "$dev" break done else dev="$(readlink -e -- "$dev")" [ -b "$dev" ] && printf '%s\n' "$dev" ||: fi bootloader-utils-0.4.23.1-alt1/detectliloboot.sh000075500000000000000000000016621224364215200214450ustar00rootroot00000000000000#!/bin/sh -efu # get boot device from lilo.conf liloconf="${1-/etc/lilo.conf}" get_global(){ sed -n -e " 0,/^[[:space:]]*other\|^[[:space:]]*image/{ s/^[[:space:]]*$1=[\"[:space:]]*\([^\"]\+\)[\"[:space:]]*/\1/p T; q # get only first line } " "$liloconf" } dev="$(get_global boot)" # If raid-extra-boot=mbr-only then bootloader is installed # in the MBR and not in the md device. if [ "$(get_global raid-extra-boot)" = "mbr-only"\ -a -z "${dev##/dev/md*}" ]; then # let's find disk on which one of the raid elements resides d="$(find /sys/block/${dev#/dev/}/slaves -type l -printf "%p\n" | head -n1)" # something like /sys/block/md0/slave/sda1 d="$(readlink -e -- "$d")" # /sys/block/sda/sda1 on old kernels (2.6.18) # or /sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1 d="${d##*/block/}" d="${d%%/*}" [ -z "$d" ] || dev="/dev/$d" fi convertdev.sh "$dev" bootloader-utils-0.4.23.1-alt1/detectloader.sh000075500000000000000000000061421224364215200210660ustar00rootroot00000000000000#!/bin/bash -efu # bash is here for \xFF symbols . shell-args show_help() { cat < must specify seekable regular file or device. Options: -q, --quiet try to be more quiet; -v, --verbose print a message for each action; -V, --version print program version and exit; -h, --help show this text and exit. Report bugs to http://bugs.altlinux.ru/ EOF exit } print_version() { echo $PROG version exit } TEMP=`getopt -n $PROG -o $getopt_common_opts -l $getopt_common_longopts -- "$@"` || show_usage eval set -- "$TEMP" while :; do case "$1" in --) shift; break ;; *) parse_common_option "$1" ;; esac shift done [ "$#" -ge 1 ] || show_usage 'Insufficient arguments.' [ "$#" -le 1 ] || show_usage 'Too many arguments.' f="${1}" [ -s "$f" -o -b "$f" ] || fatal "$f: not a file or block device" [ -r "$f" ] || fatal "$f: permission denied for reading" test_magic() { # Use decimal (123), octal (0123), or hex (0x123) digits for an offset. # Use any string for a value. # Use any number of pairs in parameters. # example: test_magic /dev/sda 0x2 LILO while [ -n "${1-}" ]; do local off="${1-}" local val="$(printf "${2-}" | od --address-radix=n --format=x1 | tr -d '\n')" shift 2 [ -n "$off" -a -n "$val" ] || fatal "test_magic: error in parameters" off="$(($off))" local len=${#val} len="$(($len/3))" # od gives 3 chars per byte local out="$(od --address-radix=n --format=x1 \ --skip-bytes="$off" --read-bytes="$len" "$f" | tr -d '\n')" verbose "comparing <$out> at offset $off with <$val>" [ "$out" = "$val" ] || return 2 done return 0 } T() { name="$1"; shift verbose "* test for $name bootloader:" if test_magic "$@"; then printf '%s\n' "$name" exit 0 fi } T empty 0 "\000\000\000\000" T grub 0 "\xEBG" 0x17d "stage1 \000" T grub 0 "\xEBH" 0x17e "stage1 \000" T grub 0 "\xEBH" 0x18a "stage1 \000" T grub 0 "\xEBH" 0x181 "GRUB \000" T grub 0x188 "GRUB \000" T grub 0x180 "GRUB \000" T lilo 2 "LILO" T lilo 6 "LILO" T grub 6 "GRUB" T osbs 2 "OSBS" #- http://www.prz.tu-berlin.de/~wolf/os-bs.html T pqmagic 0xEF "PQV" T BootStar 0x130 "BootStar:" T DocsBoot 0x148 "DocsBoot" T system_commander 0x1ad "SYSCMNDRSYS" T BeOs 0x24 "Boot Manager" T os2 0 "\xFA\xB8\x30\x00" 0xfa "OS/2" T TimO 0 "IBM Thinkpad hibernation partition" T dos 0xa0 "\x25\x03\x4E\x02\xCD\x13" T dos 0xa0 "\x00\xB4\x08\xCD\x13\x72" #- nt2k's T dos 0x60 "\xBB\x00\x7C\xB8\x01\x02\x57\xCD\x13\x5F\x73\x0C\x33\xC0\xCD\x13" #- nt's T dos 0x70 "\x0C\x33\xC0\xCD\x13\x4F\x75\xED\xBE\xA3" T freebsd 0xC0 "\x00\x30\xE4\xCD\x16\xCD\x19\xBB\x07\x00\xB4" T freebsd 0x160 "\x6A\x10\x89\xE6\x48\x80\xCC\x40\xCD\x13" T dummy 0xAC "\x0E\xB3\x07\x56\xCD\x10\x5E\xEB" #- caldera? T ranish 0x100 "\x6A\x10\xB4\x42\x8B\xF4\xCD\x13\x8B\xE5\x73" T extlinux 0 "\xFA\x31\xC0\x8E\xD8\x8E\xD0\xBC\x00\x7C\x89\xE6\x06\x57\x8E\xC0\xFB" #- mbr.bin, altmbr.bin, gptmbr.bin T os2 0x1c2 "\x0A" T Acronis 0 "\xE8\x12\x01" bootloader-utils-0.4.23.1-alt1/grub000064400000000000000000000061751224364215200167600ustar00rootroot00000000000000#!/usr/bin/perl # $Id: grub,v 1.7 2004/08/17 02:03:39 at Exp $ #-------------------------------------------------------------------- # Copyright (C) 2000, 2001, 2002 by MandrakeSoft. # Chmouel Boudjnah . # # Redistribution of this file is permitted under the terms of the GNU # Public License (GPL) #-------------------------------------------------------------------- # Copyright (C) 2003 by ALT Linux Team, # Alexey Tourbin . #-------------------------------------------------------------------- # description: Add/remove entry for grub bootloader. use strict; use bootloader_utils qw(getroot mnt2dev); use Getopt::Long qw(GetOptions); GetOptions "r|R|remove" => \my $remove, "m|memtest" => \my $memtest, "l|label=s" => \my $label and (my $version = shift) and (@ARGV == 0) or die "usage: $0 [-r|-R|--remove] [-m|--memtest] [-l|--label