updated hackfs patch

This commit is contained in:
Alex Burmashev 2014-01-21 12:47:57 +04:00
parent 581cae6ddc
commit 1840fe967d
4 changed files with 72 additions and 15 deletions

View file

@ -1,20 +1,27 @@
diff -Nur livecd-tools-18.8.old/imgcreate/live.py livecd-tools-18.8/imgcreate/live.py
--- livecd-tools-18.8.old/imgcreate/live.py 2014-01-14 19:35:52.000000000 +0400
+++ livecd-tools-18.8/imgcreate/live.py 2014-01-14 19:42:22.603447886 +0400
@@ -325,6 +325,7 @@
--- livecd-tools-18.8.old/imgcreate/live.py 2014-01-21 12:24:04.000000000 +0400
+++ livecd-tools-18.8/imgcreate/live.py 2014-01-21 12:45:02.875216282 +0400
@@ -325,6 +325,14 @@
subprocess.call(["/usr/bin/isohybrid", "-u", iso])
else:
subprocess.call(["/usr/bin/isohybrid", iso])
+ subprocess.call(["/usr/bin/rosa-image-fix.pl", iso])
+
+ arch = getBaseArch()
+ if arch in ("i386", "i586", "i686"):
+ subprocess.call(["/usr/bin/rosa-image-fix-x86.pl", iso])
+ logging.warn("iso hacked with x86 version of script")
+ elif arch in ("x86_64",):
+ subprocess.call(["/usr/bin/rosa-image-fix-x86_64.pl", iso])
+ logging.warn("iso hacked with x86_64 version of script")
self.__implant_md5sum(iso)
@@ -337,7 +338,7 @@
else:
logging.warn("isomd5sum not installed; not setting up mediacheck")
return
-
+
subprocess.call([implantisomd5, iso])
@@ -671,7 +679,7 @@
return """label local
menu label Boot from local drive
menu default
- localboot 0x80
+ localboot 0xffff
"""
def _stage_final_image(self):
def __get_grub2_stanza(self, isodir):

View file

@ -5,7 +5,7 @@
Summary: Tools for building live CDs
Name: livecd-tools
Version: 18.8
Release: 39
Release: 41
Epoch: 1
License: GPLv2
Group: System/Base
@ -17,7 +17,8 @@ URL: http://git.fedorahosted.org/git/livecd
# scp livecd*.tar.bz2 fedorahosted.org:livecd
Source0: http://fedorahosted.org/releases/l/i/livecd/%{name}-%{version}.tar.bz2
Source1: arch.py
Source2: rosa-image-fix.pl
Source2: rosa-image-fix-x86_64.pl
Source3: rosa-image-fix-x86.pl
Patch0: livecd-tools-18.8.urpmi.rosa.patch
Patch1: livecd-tools-18.8.noyum.patch
Patch2: livecd-tools-18.8.more.fixes.patch
@ -107,6 +108,8 @@ rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%__install -m 0644 %{SOURCE1} %{buildroot}%{python_sitelib}/imgcreate/
%__install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/
%__install -m 0755 %{SOURCE3} %{buildroot}%{_bindir}/
%clean
rm -rf $RPM_BUILD_ROOT
@ -123,7 +126,8 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/liveimage-mount
%{_bindir}/edit-livecd
%{_bindir}/mkbiarch
%{_bindir}/rosa-image-fix.pl
%{_bindir}/rosa-image-fix-x86_64.pl
%{_bindir}/rosa-image-fix-x86.pl
/usr/share/doc/livecd-tools*
%files -n python-imgcreate

46
rosa-image-fix-x86.pl Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/perl
use strict;
use warnings;
use Fcntl ':seek';
if (scalar(@ARGV) < 1) {
print "Usage: $0 iso-image-file\n";
exit;
}
my $filename = $ARGV[0];
my $file;
open($file, '+<', $filename) or die "Failed to open file $filename for read-write: $!";
binmode($file);
# Read the first sector (512 bytes) containing the MBR
my $mbr;
read($file, $mbr, 512) or die "Failed to read the MBR sector: $!";
# Extract the second partition record from the MBR (except for the "bootable" flag)
my $partition2 = substr($mbr, 463, 15);
# In 32-bit images we don't have the second partition (EFI), so here we'll create
# a fake partition without actual file system.
if ($partition2 eq ("\x00" x 15)) {
# Partition recod
$partition2 = "\x00\x01\x00" . # CHS: first sector = 1
"\xDA" . # partition type: non-filesystem data
"\x00\x02\x00" . # CHS: last sector = 2
"\x01\x00\x00\x00" . # LBA: first sector = 1
"\x01\x00\x00\x00"; # LBA: number of sectors = 1
}
# Now write back the desired partition table into MBR.
# The partition table starts at offset 446 and contains 4 records 16 bytes each. What we do:
# 1) Replace the first record with the second one (real or faked for 32-bit images);
# 2) Replace the first byte of the resulting first record with 0x80 (mark partition as active);
# 3) Delete the second partition by zeroing its contents.
substr($mbr, 446, 32) = "\x80" . $partition2 . ("\x00" x 16);
# Write the updated MBR back
seek($file, 0, SEEK_SET) or die "Failed to position at the beginning of the file: $!";
print $file $mbr;
close($file);