diff --git a/etc/templates/includes/initrd/initrd.common b/etc/templates/includes/initrd/initrd.common index cb008748..ecd72fd8 100644 --- a/etc/templates/includes/initrd/initrd.common +++ b/etc/templates/includes/initrd/initrd.common @@ -3,8 +3,8 @@ # create required directories makedir @initrd@/lib/modules makedir @initrd@/lib/firmware -link @initrd@/modules to @initrd@/lib/modules -link @initrd@/firmware to @initrd@/lib/firmware +link @initrd@/modules to lib/modules +link @initrd@/firmware to lib/firmware makedir @initrd@/sbin makedir @initrd@/dev makedir @initrd@/etc @@ -168,16 +168,16 @@ copy @instroot@ sbin/rmmod to @initrd@ sbin edit @initrd@/.profile text "PATH=/bin:/usr/bin:/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin\nexport PATH" # terminfos -copy @instroot@ usr/share/terminfo/a/ansi to @initrd@ etc/terminfo/a -copy @instroot@ usr/share/terminfo/d/dumb to @initrd@ etc/terminfo/d -copy @instroot@ usr/share/terminfo/l/linux to @initrd@ etc/terminfo/l -copy @instroot@ usr/share/terminfo/s/screen to @initrd@ etc/terminfo/s -copy @instroot@ usr/share/terminfo/v/vt100 to @initrd@ etc/terminfo/v -copy @instroot@ usr/share/terminfo/v/vt100-nav to @initrd@ etc/terminfo/v -copy @instroot@ usr/share/terminfo/v/vt102 to @initrd@ etc/terminfo/v -copy @instroot@ usr/share/terminfo/x/xterm to @initrd@ etc/terminfo/x -copy @instroot@ usr/share/terminfo/x/xterm-color to @initrd@ etc/terminfo/x -copy @instroot@ usr/share/terminfo/g/gnome to @initrd@ etc/terminfo/g +copy @instroot@ usr/share/terminfo/a/ansi to @initrd@ etc/terminfo/a nolinks +copy @instroot@ usr/share/terminfo/d/dumb to @initrd@ etc/terminfo/d nolinks +copy @instroot@ usr/share/terminfo/l/linux to @initrd@ etc/terminfo/l nolinks +copy @instroot@ usr/share/terminfo/s/screen to @initrd@ etc/terminfo/s nolinks +copy @instroot@ usr/share/terminfo/v/vt100 to @initrd@ etc/terminfo/v nolinks +copy @instroot@ usr/share/terminfo/v/vt100-nav to @initrd@ etc/terminfo/v nolinks +copy @instroot@ usr/share/terminfo/v/vt102 to @initrd@ etc/terminfo/v nolinks +copy @instroot@ usr/share/terminfo/x/xterm to @initrd@ etc/terminfo/x nolinks +copy @instroot@ usr/share/terminfo/x/xterm-color to @initrd@ etc/terminfo/x nolinks +copy @instroot@ usr/share/terminfo/g/gnome to @initrd@ etc/terminfo/g nolinks chmod @initrd@/etc/terminfo/*/* mode 0644 # misc diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index a7cb2deb..3b893530 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -458,9 +458,11 @@ class Lorax(object): os.chdir(cwd) if self.conf.buildarch not in ('s390', 's390x'): + # XXX this is not in usr rm(os.path.join(self.conf.treedir, 'usr', 'sbin', 'ldconfig')) - rm(os.path.join(self.conf.treedir, 'etc', 'ld.so.conf')) + # XXX why are we removing this? + #rm(os.path.join(self.conf.treedir, 'etc', 'ld.so.conf')) os.system('umount %s' % procdir) def scrub_treedir(self): diff --git a/src/pylorax/actions/base.py b/src/pylorax/actions/base.py index 38d26b37..ac5f5448 100644 --- a/src/pylorax/actions/base.py +++ b/src/pylorax/actions/base.py @@ -101,7 +101,7 @@ class LoraxAction(object): class Copy(LoraxAction): - REGEX = r'^(?P.*?)\s(?P.*?)\sto\s(?P.*?)\s(?P.*?)(\s(?Pinstall))?$' + REGEX = r'^(?P.*?)\s(?P.*?)\sto\s(?P.*?)\s(?P.*?)(\s(?Pinstall))?(\s(?Pnolinks))?$' def __init__(self, **kwargs): LoraxAction.__init__(self) @@ -116,10 +116,16 @@ class Copy(LoraxAction): else: self._attrs['install'] = False + nolinks = kwargs.get('nolinks', False) + if nolinks: + self._attrs['nolinks'] = True + else: + self._attrs['nolinks'] = False + def execute(self, verbose=False): cp(src_root=self.src_root, src_path=self.src_path, dst_root=self.dst_root, dst_path=self.dst_path, - ignore_errors=True, verbose=verbose) + nolinks=self.nolinks, ignore_errors=True, verbose=verbose) self._attrs['success'] = True @property @@ -163,12 +169,16 @@ class Copy(LoraxAction): def getDeps(self): return self._attrs['src'] + @property + def nolinks(self): + return self._attrs['nolinks'] + class Move(Copy): def execute(self, verbose=False): mv(src_root=self.src_root, src_path=self.src_path, dst_root=self.dst_root, dst_path=self.dst_path, - ignore_errors=True, verbose=verbose) + nolinks=self.nolinks, ignore_errors=True, verbose=verbose) self._attrs['success'] = True diff --git a/src/pylorax/images.py b/src/pylorax/images.py index 27fde91e..f89d5ef6 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -297,8 +297,10 @@ class InitRD(object): devices.add((vend, dev)) # create pci.ids + # XXX this file is NOT in the original initrd image... src = os.path.join(self.conf.treedir, 'usr', 'share', 'hwdata', 'pci.ids') - dst = os.path.join(self.conf.initrddir, 'pci.ids') + #dst = os.path.join(self.conf.initrddir, 'pci.ids') + dst = os.path.join(self.conf.treedir, 'pci.ids') input = open(src, 'r') pcitable = input.readlines() diff --git a/src/pylorax/utils/fileutils.py b/src/pylorax/utils/fileutils.py index 65d642b1..3b841bdd 100644 --- a/src/pylorax/utils/fileutils.py +++ b/src/pylorax/utils/fileutils.py @@ -64,7 +64,7 @@ def touch(filename, verbose=False): return True -def cp(src_path, dst_path, src_root='/', dst_root='/', ignore_errors=False, verbose=True): +def cp(src_path, dst_path, src_root='/', dst_root='/', nolinks=False, ignore_errors=False, verbose=True): filecopy = Copy(ignore_errors, verbose) src = os.path.join(src_root, src_path) @@ -74,11 +74,11 @@ def cp(src_path, dst_path, src_root='/', dst_root='/', ignore_errors=False, verb if src_path[0] != '/' and fname[0] == '/': fname = fname[1:] - filecopy.copy(fname, dst_path, src_root, dst_root) + filecopy.copy(fname, dst_path, src_root, dst_root, nolinks) return filecopy.errors -def mv(src_path, dst_path, src_root='/', dst_root='/', ignore_errors=False, verbose=True): +def mv(src_path, dst_path, src_root='/', dst_root='/', nolinks=False, ignore_errors=False, verbose=True): errors = cp(src_path, dst_path, src_root, dst_root, ignore_errors, verbose) # if everything was copied, remove the source @@ -144,7 +144,7 @@ class Copy(object): self.errors = [] - def copy(self, src_path, dst_path, src_root='/', dst_root='/'): + def copy(self, src_path, dst_path, src_root='/', dst_root='/', nolinks=False): # normalize the source and destination paths src, dst = normalize(src_root, src_path, dst_root, dst_path) @@ -195,7 +195,10 @@ class Copy(object): if os.path.islink(src): - self.__copy_link(src_path, dst_path, src_root, dst_root, src, dst) + if nolinks: + self.__copy_file(os.path.realpath(src), dst) + else: + self.__copy_link(src_path, dst_path, src_root, dst_root, src, dst) else: @@ -209,7 +212,22 @@ class Copy(object): if os.path.islink(src): - self.__copy_link(src_path, dst_path, src_root, dst_root, src, new_dst) + if nolinks: + real_src = os.path.realpath(src) + + if not os.path.exists(new_dst): + os.makedirs(new_dst) + + for fname in os.listdir(real_src): + fname = os.path.join(real_src, fname) + + if os.path.isfile(fname): + self.__copy_file(fname, new_dst) + else: + dst = os.path.join(new_dst, os.path.basename(fname)) + shutil.copytree(fname, dst, symlinks=False) + else: + self.__copy_link(src_path, dst_path, src_root, dst_root, src, new_dst) else: