public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] classes/isar-image: Collapse multiple sudo's
@ 2018-12-19 11:16 Maxim Yu. Osipov
  2019-01-07 15:19 ` Maxim Yu. Osipov
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Yu. Osipov @ 2018-12-19 11:16 UTC (permalink / raw)
  To: isar-users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-07 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19 11:16 [PATCH] classes/isar-image: Collapse multiple sudo's Maxim Yu. Osipov
2019-01-07 15:19 ` Maxim Yu. Osipov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox