From: "Maxim Yu. Osipov" <mosipov@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH] classes/isar-image: Collapse multiple sudo's
Date: Wed, 19 Dec 2018 12:16:38 +0100 [thread overview]
Message-ID: <20181219111638.22173-1-mosipov@ilbers.de> (raw)
Suggested-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
meta/classes/isar-image.bbclass | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/meta/classes/isar-image.bbclass b/meta/classes/isar-image.bbclass
index 4992800..754e896 100644
--- a/meta/classes/isar-image.bbclass
+++ b/meta/classes/isar-image.bbclass
@@ -53,26 +53,28 @@ isar_image_conf_rootfs() {
isar_image_cleanup() {
# Cleanup
- sudo rm "${IMAGE_ROOTFS}/etc/apt/sources.list.d/isar-apt.list"
- test ! -e "${IMAGE_ROOTFS}/usr/share/doc/qemu-user-static" && \
- sudo find "${IMAGE_ROOTFS}/usr/bin" \
- -maxdepth 1 -name 'qemu-*-static' -type f -delete
- sudo umount -l ${IMAGE_ROOTFS}/isar-apt
- sudo rmdir ${IMAGE_ROOTFS}/isar-apt
- sudo umount -l ${IMAGE_ROOTFS}/dev
- sudo umount -l ${IMAGE_ROOTFS}/proc
- sudo umount -l ${IMAGE_ROOTFS}/sys
- sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
- if [ "${ISAR_USE_CACHED_BASE_REPO}" = "1" ]; then
- sudo umount -l ${IMAGE_ROOTFS}/base-apt
- sudo rmdir ${IMAGE_ROOTFS}/base-apt
- # Replace the local apt we bootstrapped with the
- # APT sources initially defined in DISTRO_APT_SOURCES
- sudo rm -f "${IMAGE_ROOTFS}/etc/apt/sources.list.d/base-apt.list"
- sudo mv "${IMAGE_ROOTFS}/etc/apt/sources-list" \
+ sudo sh -c ' \
+ rm "${IMAGE_ROOTFS}/etc/apt/sources.list.d/isar-apt.list"
+ test ! -e "${IMAGE_ROOTFS}/usr/share/doc/qemu-user-static" && \
+ find "${IMAGE_ROOTFS}/usr/bin" \
+ -maxdepth 1 -name 'qemu-*-static' -type f -delete
+ umount -l ${IMAGE_ROOTFS}/isar-apt
+ rmdir ${IMAGE_ROOTFS}/isar-apt
+ umount -l ${IMAGE_ROOTFS}/dev
+ umount -l ${IMAGE_ROOTFS}/proc
+ umount -l ${IMAGE_ROOTFS}/sys
+ rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
+ if [ "${ISAR_USE_CACHED_BASE_REPO}" = "1" ]; then
+ umount -l ${IMAGE_ROOTFS}/base-apt
+ rmdir ${IMAGE_ROOTFS}/base-apt
+ # Replace the local apt we bootstrapped with the
+ # APT sources initially defined in DISTRO_APT_SOURCES
+ rm -f "${IMAGE_ROOTFS}/etc/apt/sources.list.d/base-apt.list"
+ mv "${IMAGE_ROOTFS}/etc/apt/sources-list" \
"${IMAGE_ROOTFS}/etc/apt/sources.list.d/bootstrap.list"
- fi
- sudo rm -f "${IMAGE_ROOTFS}/etc/apt/sources-list"
+ fi
+ rm -f "${IMAGE_ROOTFS}/etc/apt/sources-list"
+ '
}
do_rootfs() {
--
2.11.0
next reply other threads:[~2018-12-19 11:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 11:16 Maxim Yu. Osipov [this message]
2019-01-07 15:19 ` Maxim Yu. Osipov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181219111638.22173-1-mosipov@ilbers.de \
--to=mosipov@ilbers.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox