Use xz when compressing the initrd
This makes the image a lot smaller.
This commit is contained in:
parent
ee955f3ad1
commit
a9e52a70f4
@ -26,6 +26,7 @@ Requires: util-linux-ng
|
|||||||
Requires: dosfstools
|
Requires: dosfstools
|
||||||
Requires: genisoimage
|
Requires: genisoimage
|
||||||
Requires: parted
|
Requires: parted
|
||||||
|
Requires: pyliblzma
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Lorax is a tool for creating the anaconda install images.
|
Lorax is a tool for creating the anaconda install images.
|
||||||
|
@ -26,6 +26,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import gzip
|
import gzip
|
||||||
|
import lzma
|
||||||
import re
|
import re
|
||||||
import glob
|
import glob
|
||||||
import time
|
import time
|
||||||
@ -478,7 +479,7 @@ class LoraxInstallTree(BaseLoraxClass):
|
|||||||
dst = joinpaths(self.root, "sbin")
|
dst = joinpaths(self.root, "sbin")
|
||||||
shutil.copy2(src, dst)
|
shutil.copy2(src, dst)
|
||||||
|
|
||||||
def compress(self, initrd, kernel):
|
def compress(self, initrd, kernel, type="xz"):
|
||||||
chdir = lambda: os.chdir(self.root)
|
chdir = lambda: os.chdir(self.root)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
@ -493,9 +494,15 @@ class LoraxInstallTree(BaseLoraxClass):
|
|||||||
stdin=find.stdout, stdout=subprocess.PIPE,
|
stdin=find.stdout, stdout=subprocess.PIPE,
|
||||||
preexec_fn=chdir)
|
preexec_fn=chdir)
|
||||||
|
|
||||||
gzipped = gzip.open(initrd.fpath, "wb")
|
if type == "gzip":
|
||||||
gzipped.write(cpio.stdout.read())
|
compressed = gzip.open(initrd.fpath, "wb")
|
||||||
gzipped.close()
|
elif type == "xz":
|
||||||
|
compressed = lzma.LZMAFile(initrd.fpath, "w",
|
||||||
|
options={"format":"xz", "check":"crc32",
|
||||||
|
"level":9})
|
||||||
|
|
||||||
|
compressed.write(cpio.stdout.read())
|
||||||
|
compressed.close()
|
||||||
|
|
||||||
# move modules out of the tree again
|
# move modules out of the tree again
|
||||||
shutil.move(joinpaths(self.root, "modules", kernel.version),
|
shutil.move(joinpaths(self.root, "modules", kernel.version),
|
||||||
|
Loading…
Reference in New Issue
Block a user