From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6899501277566205952 X-Received: by 2002:a17:90a:fd88:: with SMTP id cx8mr4868041pjb.220.1606415425193; Thu, 26 Nov 2020 10:30:25 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:902:524:: with SMTP id 33ls1327582plf.6.gmail; Thu, 26 Nov 2020 10:30:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbunCOb8XprtBVZxGEXgjzgk8uIxk+5jXHUYWcY3RfEM2lK/JBGZrq2bFVNz+10ZrtLQhI X-Received: by 2002:a17:90b:104c:: with SMTP id gq12mr4929412pjb.167.1606415424362; Thu, 26 Nov 2020 10:30:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606415424; cv=none; d=google.com; s=arc-20160816; b=w5rLAtefXP4ku3ZNuiNpJGvjtOL57LtleKX1nBv1SjBTDzzNe7uvDiBuUlE7bMk6Sp Yt6c+IWPlReHPYLVQ3LijUHwI/qKDG5UKdPNZJHLs4WTuu0EfcMS8GaYg4h1He70UG+q NYDoETkbX5gie9eutx7wm7S4OEzv5PiU7hM4sFo7PDsNUARWkzyeMl975CC/Yz459pM3 VwFxFO/WJoRMcrXKGA1esWaN+CLgFjAKg/DgpkILVXh1OfWEqavRb5Am4vnS/N7RDS6V sihyjZXuTM1ATowWoMmtkvhY43ep1ISjKk7TvtwUFq8sRZ+QUEi1+9f951dIwdEfL+5d k6wA== 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=bz3Ffi+QTqIAkvjPfuanrzWssstDOmJH3k0IUQraIwQ=; b=XacYQs1vPd5LZB5u+zhCkSHfjjyoLeagnWc557FKhFfraPq2dC4l8PA8C+m/4TTkOJ 9bMkzwnwD9TN6NaV4XfM2zwASArGXluXkNsUt8kmPBfQ0rO9WXnxzM8SvLfR3rXpGk/M bnJgK00RY+dmvbCIAlin8aNepi5DwIjC6w7hCxI8qmnQ619kHhWjBl/y8ZvYPtsSlrap rI514BX3AvgjS7R4JV6X7Lh9/c1RxCO3/yZ8cSLNiAbtrKBSrqJOXG+7Cswwdw12RdNt cnpfp3DaexLUoa4ut4AOCe8/6v17pxMqGJB+QH6SmmBeCONdo+S94wzSvKInXCHBDYpp Sc4A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.141.98 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com. [68.232.141.98]) by gmr-mx.google.com with ESMTPS id s12si571207pjq.3.2020.11.26.10.30.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Nov 2020 10:30:24 -0800 (PST) Received-SPF: pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.141.98 as permitted sender) client-ip=68.232.141.98; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.141.98 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com IronPort-SDR: gkM9v6I/19GW0dbaB4LWEs4T6XBqqWWPCrm9wUN+Sw9Mk3S62ojFb2HZk0PbedG+pqQVizw+fD Rfkk7yuWcbD5HuWQWAJsNvJ+4xcdi4UaAtZ8o2tX/w6nZbBfiw59P/ub2s48G402nh/o6ZozBU k8hZUULW0AzcWopj7REfw03DqkkeiD1Qobe+l6wk41m6jHq9w30qAQJt4s/ApQwNJW/r1TqTyV YxmuQMuj/G2Sbqd25TlQpdj20uBFCyBH+yckfR9b8h27sFuP1bhPy/DHbq3jMkdXzSyvyc6jcB 9K8= X-IronPort-AV: E=Sophos;i="5.78,372,1599552000"; d="scan'208";a="55536078" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 26 Nov 2020 10:30:23 -0800 IronPort-SDR: R5W0NFf5+JNWBjsC1vLx1PH61ndf6bJIu1GmST7ABZz9GuAYG5ONLQYo7CXJ2icLQVgwd6IpXO tpZJlJTqoYubeCIj0MhkxYShfoyiExABdd2D2ZfYFsEYmYKb3zDDQ/QAfKqtweV+Cp2BTEv2Ac DT7hpeptyehTPa8feDJbkSzIPB3MT5Jym44n5D4oi+tLLJCcACIin4kr5tLTzWQBRFnTHR4kqd H2uXZsXKF8MLq8W035X/h+BbopQy3ae5Ny+bjMrTc+tpbscBlfarQdLD8UC+1zk8dF4fkuuLZi TwM= From: Vijai Kumar K To: CC: Vijai Kumar K Subject: [PATCH v10 12/14] rootfs: Fix possible overwrite of existing resolv.conf Date: Thu, 26 Nov 2020 23:59:51 +0530 Message-ID: <20201126182953.7518-4-Vijaikumar_Kanagarajan@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201126182953.7518-1-Vijaikumar_Kanagarajan@mentor.com> References: <20201126182818.7261-9-Vijaikumar_Kanagarajan@mentor.com> <20201126182953.7518-1-Vijaikumar_Kanagarajan@mentor.com> MIME-Version: 1.0 Content-Type: text/plain Return-Path: Vijaikumar_Kanagarajan@mentor.com X-ClientProxiedBy: SVR-ORW-MBX-07.mgc.mentorg.com (147.34.90.207) To svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) X-TUID: D7zrJVAbo4ex 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 b589dbc..99f677b 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