diff --git a/imgutil/el10/dracut/install b/imgutil/el10/dracut/install index f597e39e..b8ec9ad7 100644 --- a/imgutil/el10/dracut/install +++ b/imgutil/el10/dracut/install @@ -3,7 +3,8 @@ dracut_install /lib64/libtss2-tcti-device.so.0 dracut_install tpm2_create tpm2_pcrread tpm2_createpolicy tpm2_createprimary dracut_install tpm2_load tpm2_unseal tpm2_getcap tpm2_evictcontrol dracut_install tpm2_pcrextend tpm2_policypcr tpm2_flushcontext tpm2_startauthsession -dracut_install curl openssl tar cpio gzip lsmod ethtool xz unsquashfs lsmod ethtool +dracut_install curl openssl tar cpio gzip lsmod ethtool xz lsmod ethtool +dracut_install -o unsquashfs # optional, imageboot extracts with cp when absent dracut_install modprobe touch echo cut wc bash uniq grep ip hostname dracut_install awk egrep dirname expr sort dracut_install ssh sshd reboot parted mkfs mkfs.ext4 mkfs.xfs xfs_db mkswap diff --git a/imgutil/el9/dracut/install b/imgutil/el9/dracut/install index 362e3bc6..4273efdb 100644 --- a/imgutil/el9/dracut/install +++ b/imgutil/el9/dracut/install @@ -3,7 +3,8 @@ dracut_install /lib64/libtss2-tcti-device.so.0 dracut_install tpm2_create tpm2_pcrread tpm2_createpolicy tpm2_createprimary dracut_install tpm2_load tpm2_unseal tpm2_getcap tpm2_evictcontrol dracut_install tpm2_pcrextend tpm2_policypcr tpm2_flushcontext tpm2_startauthsession -dracut_install curl openssl tar cpio gzip lsmod ethtool xz unsquashfs lsmod ethtool +dracut_install curl openssl tar cpio gzip lsmod ethtool xz lsmod ethtool +dracut_install -o unsquashfs # optional, imageboot extracts with cp when absent dracut_install modprobe touch echo cut wc bash uniq grep ip hostname dracut_install awk egrep dirname expr sort dracut_install ssh sshd reboot parted mkfs mkfs.ext4 mkfs.xfs xfs_db mkswap diff --git a/imgutil/imgutil b/imgutil/imgutil index 772285f1..8201d193 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -222,6 +222,8 @@ async def capture_remote(args): for cmd in unmet: sys.stderr.write(cmd + '\n') sys.exit(1) + for cmd in finfo.get('optionalprereqs', []): + sys.stderr.write(cmd + '\n') oscat = finfo['oscategory'] subprocess.check_call(['ssh', '-o', 'LogLevel=QUIET', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocal']) utillib = __file__.replace('bin/imgutil', 'lib/imgutil') @@ -471,6 +473,7 @@ class OsHandler(object): self.sourcepath = None self.osname = '{}-{}-{}'.format(name, version, arch) self.captureprereqs = [] + self.captureadvisories = [] try: pkglist = args.packagelist except AttributeError: @@ -507,7 +510,8 @@ class OsHandler(object): if not isinstance(odata[idx], str): odata[idx] = odata[idx].decode('utf8') info = {'oscategory': odata[0], - 'version': odata[1], 'arch': odata[2], 'name': odata[3], 'unmetprereqs': self.captureprereqs} + 'version': odata[1], 'arch': odata[2], 'name': odata[3], 'unmetprereqs': self.captureprereqs, + 'optionalprereqs': self.captureadvisories} return json.dumps(info) def prep_root_premount(self, args): @@ -681,16 +685,21 @@ class DebHandler(OsHandler): self.oscategory = name + version super().__init__(name, version, arch, args) needpkgs = [] + wantpkgs = [] if not os.path.exists(os.path.join(hostpath, 'usr/bin/tpm2_getcap')): needpkgs.append('tpm2-tools') - if not os.path.exists(os.path.join(hostpath, 'usr/bin/unsquashfs')): - needpkgs.append('squashfs-tools') lfuses = glob.glob(os.path.join(hostpath, '/lib/*/libfuse.so.2')) if not lfuses: needpkgs.append('libfuse2') + if not os.path.exists(os.path.join(hostpath, 'usr/bin/unsquashfs')): + wantpkgs.append('squashfs-tools') if needpkgs: needapt = 'Missing packages needed in target for capture, to add required packages: apt install ' + ' '.join(needpkgs) self.captureprereqs.append(needapt) + if wantpkgs: + wantapt = ('Missing optional packages in target, untethered boot will extract the image more slowly, ' + 'to add them: apt install ' + ' '.join(wantpkgs)) + self.captureadvisories.append(wantapt) def add_pkglists(self): self.includepkgs.extend(self.list_packages()) @@ -768,6 +777,7 @@ class ElHandler(OsHandler): self.yumargs = [] super().__init__(name, version, arch, args) needpkgs = [] + wantpkgs = [] if not hostpath: return if not os.path.exists(os.path.join(hostpath, 'usr/bin/tpm2_getcap')): @@ -781,13 +791,17 @@ class ElHandler(OsHandler): needpkgs.append('dhcp-client') if not os.path.exists(os.path.join(hostpath, 'usr/sbin/mount.nfs')): needpkgs.append('nfs-utils') - if (self.oscategory in ('el9', 'el10') and + if (self.oscategory not in ('el7', 'el8') and not os.path.exists(os.path.join(hostpath, 'usr/sbin/unsquashfs')) and not os.path.exists(os.path.join(hostpath, 'usr/bin/unsquashfs'))): - needpkgs.append('squashfs-tools') + wantpkgs.append('squashfs-tools') if needpkgs: needapt = 'Missing packages needed in target for capture, to add required packages: dnf install ' + ' '.join(needpkgs) self.captureprereqs.append(needapt) + if wantpkgs: + wantdnf = ('Missing optional packages in target, untethered boot will extract the image more slowly, ' + 'to add them: dnf install ' + ' '.join(wantpkgs)) + self.captureadvisories.append(wantdnf) def add_pkglists(self): self.yumargs.extend(self.list_packages()) diff --git a/imgutil/ubuntu/initramfs-tools/hooks/confluent b/imgutil/ubuntu/initramfs-tools/hooks/confluent index 62e95c55..e352173b 100644 --- a/imgutil/ubuntu/initramfs-tools/hooks/confluent +++ b/imgutil/ubuntu/initramfs-tools/hooks/confluent @@ -33,7 +33,7 @@ copy_exec /usr/bin/tpm2_pcrextend copy_exec /usr/bin/ssh-keygen copy_exec /usr/sbin/sshd copy_exec /usr/sbin/mkfs.xfs -copy_exec /usr/bin/unsquashfs +[ -e /usr/bin/unsquashfs ] && copy_exec /usr/bin/unsquashfs [ -e /usr/lib/openssh/sshd-session ] && copy_exec /usr/lib/openssh/sshd-session [ -e /usr/lib/x86_64-linux-gnu/libfuse.so.2 ] && copy_exec /usr/lib/x86_64-linux-gnu/libfuse.so.2 [ -e /usr/lib/aarch64-linux-gnu/libfuse.so.2 ] && copy_exec /usr/lib/aarch64-linux-gnu/libfuse.so.2