aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2017-12-26 09:18:58 -0500
committerAnthony G. Basile <blueness@gentoo.org>2017-12-26 09:18:58 -0500
commit906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8 (patch)
tree2338dbfc1304b4712ed387b92719cd0027ad84cd
parentgrs/Netboot.py: chmod 755 the init script (diff)
downloadgrss-906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8.tar.gz
grss-906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8.tar.bz2
grss-906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8.zip
grs/Netboot.py: move kernel/initramfs to tmpdir
-rw-r--r--grs/Netboot.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/grs/Netboot.py b/grs/Netboot.py
index 0918f1a..469418c 100644
--- a/grs/Netboot.py
+++ b/grs/Netboot.py
@@ -45,7 +45,8 @@ class Netboot(HashIt):
self.month = str(datetime.now().month).zfill(2)
self.day = str(datetime.now().day).zfill(2)
self.medium_name = 'initramfs-%s-%s%s%s' % (name, self.year, self.month, self.day)
- self.digest_name = 'initramfs-%s.DIGESTS' % self.medium_name
+ self.digest_name = '%s.DIGESTS' % self.medium_name
+ self.kernelname = 'kernel-%s-%s%s%s' % (name, self.year, self.month, self.day)
def netbootit(self, alt_name=None):
@@ -54,30 +55,25 @@ class Netboot(HashIt):
self.medium_name = 'initramfs-%s-%s%s%s' % (alt_name, self.year, self.month, self.day)
self.digest_name = 'initramfs-%s.DIGESTS' % self.medium_name
- # 0. Pepare netboot directory
- netboot_dir = os.path.join(self.tmpdir, 'netboot')
- shutil.rmtree(netboot_dir, ignore_errors=True)
- os.makedirs(netboot_dir, mode=0o755, exist_ok=False)
-
- # 1. Move the kernel into the netboot directory.
- kernel_dir = os.path.join(self.portage_configroot, 'boot')
- kernel_path = os.path.join(kernel_dir, 'kernel')
- shutil.copy(kernel_path, netboot_dir)
+ # 1. Move the kernel to the tmpdir directory.
+ kernel_src = os.path.join(self.portage_configroot, 'boot/kernel')
+ kernel_dst = os.path.join(self.tmpdir, self.kernelname)
+ shutil.copy(kernel_src, kernel_dst)
# 2. Unpack the initramfs into kernelroot/initramfs direcotry
initramfs_root = os.path.join(self.kernelroot, 'initramfs')
shutil.rmtree(initramfs_root, ignore_errors=True)
os.makedirs(initramfs_root, mode=0o755, exist_ok=False)
- initramfs_path = os.path.join(kernel_dir, 'initramfs')
- cmd = 'xz -dc %s | cpio -idv' % (initramfs_path)
+ initramfs_src = os.path.join(self.portage_configroot, 'boot/initramfs')
+ cmd = 'xz -dc %s | cpio -idv' % (initramfs_src)
cwd = os.getcwd()
os.chdir(initramfs_root)
Execute(cmd, timeout=600, logfile=self.logfile, shell=True)
os.chdir(cwd)
- # 3. Make the squashfs image in the netboot directory.
+ # 3. Make the squashfs image in the tmpdir directory.
squashfs_dir = os.path.join(initramfs_root, 'mnt/cdrom')
shutil.rmtree(squashfs_dir, ignore_errors=True)
os.makedirs(squashfs_dir, mode=0o755, exist_ok=False)
@@ -92,8 +88,8 @@ class Netboot(HashIt):
os.chmod(init_dst, 0o0755)
# 5. Repack
- initramfs_path = os.path.join(netboot_dir, self.medium_name)
- cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_path
+ initramfs_dst = os.path.join(self.tmpdir, self.medium_name)
+ cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_dst
cwd = os.getcwd()
os.chdir(initramfs_root)