From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7366638117472698368 X-Received: by 2002:a05:600c:1d18:b0:418:3d59:c13a with SMTP id 5b1f17b1804b1-41f2d63b2famr57568795e9.9.1715179097755; Wed, 08 May 2024 07:38:17 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:600c:580a:b0:41e:d958:747 with SMTP id 5b1f17b1804b1-41f7b874173ls2788215e9.1.-pod-prod-00-eu-canary; Wed, 08 May 2024 07:38:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhtiN9/wzmfcnP+kgnh41JJGvu409dylaDiHutZngVihNqYX0eNGJtaodcLWV58ClH8msH X-Received: by 2002:a05:600c:45d3:b0:41c:66:18c2 with SMTP id 5b1f17b1804b1-41f2d440081mr50662975e9.4.1715179095631; Wed, 08 May 2024 07:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715179095; cv=none; d=google.com; s=arc-20160816; b=CQln570o5nbLuV07j3cCzEaK0P7y9+bSUv1e3uZwZ/IV9ny2ZDrf3gGPALaa51Y3b+ 9aoFtJ7IDPBrjQ64cTSrkeWH/NNAYpQiUuPpQ1Ic0Z0usoU6EOpc0hAowyj/I8PZ3tWQ NbYD4memrm9Fr//N8cWE2i2uLI6i9uHfADniK4gZIscpMQtHOZ8BPoEzn5zDlXj0MTYR UAzJPnyC/Gn4HHuF0grC7tVtbvbDb6MijGHVFfgb/aJWPJOqxVjf3B/ORcsfNQhAk5fP HrgtG+ddiYWz/bRfC0OdMJNImPwwHcJz+zd9182Ox59NjiTDwT+8QQB4itFULwmVe51s 3iPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=EWhABrc1pmo7/iAWDosg2wG5qUslz0NgDbCOfZlH3Gs=; fh=/h9QQkzJ8EboVkWg45aWwpaUro6WMavIVd2OhN45RtE=; b=GkYz7FqcVIBjElObXFQiQD7jv0h6i3SS6cxvv1323NuCySngND+4vyHCWEWqdPb8Vb wu1M2IgnKgZ0rzLpoEUjLNqKF9b5CUwj2PVvoDFTo5c+3L2vqHXq9mZXZPrMnUhWIfmy 0CwXKYwFJjfIGB0ewRJWpgN7MG0s6feGUPU7UOpPFvVrun0hPlKmmeVMOOe8qsP23irk +dOcFChd5RxiSG/NYNmN16kWc02c+7vxOFyvjHyOoaL4/DUafu2Fj/qzp4i7UPtQZHE5 Szv5BAMjqiuxst4cQ5qxWjoZ581R77zALZergWtqrv9SO5+CMn7OKJ2Dd4F+11iMdCMW 0NMA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-41f43080137si2512975e9.0.2024.05.08.07.38.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 May 2024 07:38:15 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from user-B660.promwad.corp ([159.148.83.123]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 448EcAtn032711 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 8 May 2024 16:38:15 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Anton Mikanovich Subject: [PATCH 4/4] wic: Restore compatibility with old distros Date: Wed, 8 May 2024 17:38:01 +0300 Message-Id: <20240508143801.557383-5-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240508143801.557383-1-amikan@ilbers.de> References: <20240508143801.557383-1-amikan@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: buNLA7rCljcQ After update of WIC it requires sfdisk to support --disk-id command, which is false for Debian Buster and Ubuntu Focal. Do not try to set disk identifier for those distro versions to keep them buildable but with lack of reproducibility. This hack should be removed after deprecation of Buster and Focal. Signed-off-by: Anton Mikanovich --- scripts/lib/wic/plugins/imager/direct.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 33a869ec..a65ae36a 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -530,6 +530,13 @@ class PartitionedImage(): exec_native_cmd("parted -s %s mklabel %s" % (device, ptable_format), self.native_sysroot) + def _sfdisk_supports_disk_id(self): + ret, help_out = exec_native_cmd("sfdisk --help", self.native_sysroot) + if 'disk-id' not in help_out: + logger.warn("Current sfdisk version DOES NOT support changing disk ID") + return False + return True + def _write_disk_guid(self): if self.ptable_format in ('gpt', 'gpt-hybrid'): if os.getenv('SOURCE_DATE_EPOCH'): @@ -537,6 +544,11 @@ class PartitionedImage(): else: self.disk_guid = uuid.uuid4() + # Backport compatibility for Debian Buster and Ubuntu Focal + if not self._sfdisk_supports_disk_id(): + logger.warn("Disk identifier can't be set, reproducibility is broken!") + return + logger.debug("Set disk guid %s", self.disk_guid) sfdisk_cmd = "sfdisk --disk-id %s %s" % (self.path, self.disk_guid) exec_native_cmd(sfdisk_cmd, self.native_sysroot) -- 2.34.1