From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6878157486786871296 X-Received: by 2002:ac2:5bd1:: with SMTP id u17mr897030lfn.171.1606291568404; Wed, 25 Nov 2020 00:06:08 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:d0e:: with SMTP id 14ls872783lfn.0.gmail; Wed, 25 Nov 2020 00:06:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTEcKMVxQVWtm8DKcy8LlkI+WasBq6UNfJiMUzhG6zu5eSrI2UCe1S5iRUTAWEq+rFXCJu X-Received: by 2002:a19:bec6:: with SMTP id o189mr935098lff.179.1606291567243; Wed, 25 Nov 2020 00:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606291567; cv=none; d=google.com; s=arc-20160816; b=URn1ddMHUMoe2QpMWiCVNZsxC46EAeyyNUQGDRj4MDM5LTw5Dk0GmKp1LWdxBgf/os IP8oen0JcwSMQBSN6ev7TVP156qnTbyf089iLjQaNZkLeK3CbPugF7PyL9qjWV/B9Fhg rPTCjTU7FlwO0gCVwYHdEJLmvYtemmEn3vT1zAVbWGFSNW7hiYM4zKS0HuCJkw1WxE80 JY88oTij+/ew4/aqze3o8hu5/7xnGPig8rZLNPLCFf741rci5A6VfGp1Xw6TnvLvH6FK ftjYXSKuDqN7kUfm6ODXPa+0Z/RZfF5zEYoeq8RUEXM9Lt+HXeJfANd3a8xN6IS39cbJ yyaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:ironport-sdr:ironport-sdr; bh=m56Ql/yoYpxgzaP8G+s9k7Tl2aypB9c8UmAgAfs7OO4=; b=QhnjKAz/+Q5kO77myA5t2EPxGYVNhdW+TO9+6lpCrpj9aHPL2Q6vUGhr41mVJCUeMS +AwgT2UTHYGKcCynV6AMMakQ3yGzH+sxlhQQpnt/ijANFnWfOchOXQzity7eVkAmGxgB 5wH83ow0vMCfwAPIcSMnNcMfgk8PUhvDW5CG7scqrC6/llS3/DC2qefJaJGNM8eLGqOg 2QPArboAfeW4dSoz8xP0GSpKoeBPRuRXC5GkDKQyGHdVnPipigiiDPflUfZZCgnzJpEo E63r8SXCAN9eyLwgMPGHvzx5zXvcwFieZY51xnE2/e6XkieL5f3qBUPGhZv7OG2bNi1K O0fg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com. [68.232.137.252]) by gmr-mx.google.com with ESMTPS id f5si63813ljc.0.2020.11.25.00.06.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Nov 2020 00:06:07 -0800 (PST) Received-SPF: pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) client-ip=68.232.137.252; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com IronPort-SDR: ttvIm9dF88JIjQa0e379DxzpqDH+l1IlDFeXe46V7OuZy06qqAJs57C66aZ0ePjjOFj4jbbgFP b+hbwv7dCthT1dABfRCjoDKpfqdNoIEwseNwWyz8JhYJeWCa9YB6tqtL4lecVaIwEX4sws8+fa BMxPGw6k0SJnvF4jV8BgE7tcVtebRaSGAEpdybSKKmZgENKrztaXotYDdn8rFNYc8mP57efEvI GXqIZnJb4M/7qkcLa+W7kMT6+Cp/MVlMup7wfptyeJ03AEeinGC/qypeqWv1bQXaybHfHPG+ld 1Ac= X-IronPort-AV: E=Sophos;i="5.78,368,1599552000"; d="scan'208";a="55587688" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 25 Nov 2020 00:06:06 -0800 IronPort-SDR: jmfVNrgwM2aFb5es6I4xk1oHSrjoNOATfbIX9Kp6NgJClE01SgB9ErQ46E3Dg7Uz9vVDDz5lsG XNiq8JMg9+xT7dJJ1D2y8j+Exbv2h+Hh62duiT2gjjtxeCYpSup0L3tnzHMOIC8ZDiynhuKPA4 DwgriglQLx3EYyghZXeSpleiKltFRBB2Ou0fyQoRpptsq3gdAhjDXOnIYAqjQhGBCRdo5CM91g ZrXrqW06z0UsWe79ffD0HfkRycHH8GTYB/cT+OIJYNXUSQjvM2kEPlQaQHk3nzVshCBhCUyByc E9Q= From: Vijai Kumar K To: CC: Vijai Kumar K Subject: [PATCH v7 12/14] rootfs: Fix possible overwrite of existing resolv.conf Date: Wed, 25 Nov 2020 13:35:33 +0530 Message-ID: <20201125080535.16223-4-Vijaikumar_Kanagarajan@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125080535.16223-1-Vijaikumar_Kanagarajan@mentor.com> References: <20201125080301.15818-9-Vijaikumar_Kanagarajan@mentor.com> <20201125080535.16223-1-Vijaikumar_Kanagarajan@mentor.com> MIME-Version: 1.0 Content-Type: text/plain Return-Path: Vijaikumar_Kanagarajan@mentor.com X-ClientProxiedBy: svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) To svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) X-TUID: MgCtvxGbarDu There is a possiblilty that one of the packages installed in the rootfs provides /etc/resolv.conf and we might accidentally remove it. Fix it by taking a backup of any existing resolv conf files and restoring it later. This is needed since we could not effectively move caching before rootfs_install_clean_files since we need the latest dpkg log. Signed-off-by: Vijai Kumar K --- meta/classes/rootfs.bbclass | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass index 0aa5502..ed43fb9 100644 --- a/meta/classes/rootfs.bbclass +++ b/meta/classes/rootfs.bbclass @@ -186,10 +186,18 @@ python do_rootfs_install() { addtask rootfs_install before do_rootfs_postprocess after do_unpack cache_deb_src() { + if [ -e "${ROOTFSDIR}"/etc/resolv.conf ]; then + sudo mv "${ROOTFSDIR}"/etc/resolv.conf "${ROOTFSDIR}"/etc/resolv.conf.isar + fi rootfs_install_resolvconf + deb_dl_dir_import ${ROOTFSDIR} ${ROOTFS_DISTRO} debsrc_download ${ROOTFSDIR} ${ROOTFS_DISTRO} - rootfs_install_clean_files + + sudo rm -f "${ROOTFSDIR}"/etc/resolv.conf + if [ -e "${ROOTFSDIR}"/etc/resolv.conf.isar ]; then + sudo mv "${ROOTFSDIR}"/etc/resolv.conf.isar "${ROOTFSDIR}"/etc/resolv.conf + fi } ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'clean-package-cache', 'rootfs_postprocess_clean_package_cache', '', d)}" -- 2.17.1