From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-993120-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 091D7138AE9
	for <garchives@archives.gentoo.org>; Tue, 26 Dec 2017 14:19:20 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id CC5C4E0D1A;
	Tue, 26 Dec 2017 14:19:17 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 9A1C8E0D1A
	for <gentoo-commits@lists.gentoo.org>; Tue, 26 Dec 2017 14:19:17 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id DC1C633DDA5
	for <gentoo-commits@lists.gentoo.org>; Tue, 26 Dec 2017 14:19:14 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 69D9AAE7E
	for <gentoo-commits@lists.gentoo.org>; Tue, 26 Dec 2017 14:19:13 +0000 (UTC)
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" <blueness@gentoo.org>
Message-ID: <1514297938.906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8.blueness@gentoo>
Subject: [gentoo-commits] proj/grss:master commit in: grs/
X-VCS-Repository: proj/grss
X-VCS-Files: grs/Netboot.py
X-VCS-Directories: grs/
X-VCS-Committer: blueness
X-VCS-Committer-Name: Anthony G. Basile
X-VCS-Revision: 906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8
X-VCS-Branch: master
Date: Tue, 26 Dec 2017 14:19:13 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 96f6d96a-3979-4316-be3c-0aee0b0894ad
X-Archives-Hash: a03128986389d5eb4bb306f53463c472

commit:     906e7ab1dd3b7dfb10bafae1bcdf4a1bccc55cd8
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 14:18:58 2017 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 14:18:58 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=906e7ab1

grs/Netboot.py: move kernel/initramfs to tmpdir

 grs/Netboot.py | 26 +++++++++++---------------
 1 file 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)