From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7366638117472698368 X-Received: by 2002:a05:600c:1547:b0:420:1078:a74c with SMTP id 5b1f17b1804b1-4201078a89cmr129402165e9.20.1715946291058; Fri, 17 May 2024 04:44:51 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:600c:1c19:b0:416:664d:e4c6 with SMTP id 5b1f17b1804b1-41fc20e7e6dls37526325e9.1.-pod-prod-06-eu; Fri, 17 May 2024 04:44:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0ISYds3K19HFXJfv9p321dyc9tBGLo3h28EIhSWmzvGUwqP4CTiTGAp6WRFne3xWJwdJc X-Received: by 2002:adf:e58d:0:b0:351:da14:9368 with SMTP id ffacd0b85a97d-351da1494demr2795667f8f.40.1715946289017; Fri, 17 May 2024 04:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715946289; cv=none; d=google.com; s=arc-20160816; b=XwG7R9huZbxXHgRS/qnBuMa4OssnmgKcf0kqt93gOPOdJ+nwARCQXgOAgOJ12aVJWt XoCibZyJh/E9eLqf705BPdSJn8oHcgZdrs6yE9iMMIiQXgCOVj5ZuKmyIPmCXr/YJgGF M1pJ+AEITwqrpRjcFrpYsuh4qOS8lG1vOvJcyY1Q4Q6U3N2z0n+42WnJClOKGxHZdIpk iReu0W4qd9VmMtKKZhKQIDcv9n5tt1ant9NeBSNzt9LQeQ42TCMsIzySRzOGBEyuVkPK 7eal85dawm+waQRA8XEvNVQIDvzRkHp7Q0tQS1l34LeaLdwxC/2PDF5wimICXNkii8eT a+dQ== 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=p/d7WYSuYLKbRFgw+K4twRcRkfj5f7rMVMKKksEwk3iChyR1R/z4rB3/ZKfTn2guwW njblD3E0qCvqDvom4pTV8OUGzQdU+ssX1/G9LtLdtGy/Gz95YVv7VPm1PRqbGp95jC+b rhavT1A7zAgEZJKUVilbGWdcdFwdlA7QO1PLYTNo4auT28eghTFyg5dgQyRI/fPqcPJ+ ZdLeGQPFqDjM2Lpj6Vu6xKELcF/0h/rxIdyw+RS5LBrqWCcpGUzmCpOTtImwP8bI+YQb Bg1hnKik/qfkniY+N77Hgl1EkHacId+mW1N6G/40/mMe8QW+mEJ3I0fq4dchoQE9LbN0 clyA==; 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 ffacd0b85a97d-3502b8a393csi542811f8f.2.2024.05.17.04.44.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 May 2024 04:44:48 -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 44HBigmf015192 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 May 2024 13:44:48 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Anton Mikanovich Subject: [PATCH v2 4/4] wic: Restore compatibility with old distros Date: Fri, 17 May 2024 14:44:34 +0300 Message-Id: <20240517114434.778656-5-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240517114434.778656-1-amikan@ilbers.de> References: <20240517114434.778656-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: 7H1Jgo1gz+L9 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