From f4d79d3a194e2c99551fb91e77c663dfb74cb255 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 22 Dec 2017 22:12:16 +0000 Subject: Use sudo when cleaning the chroot directory. --- drakclassic | 8 +++++++- draklive | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drakclassic b/drakclassic index da1f875..e120402 100755 --- a/drakclassic +++ b/drakclassic @@ -51,7 +51,13 @@ $::force = 0; sub clean { my ($build) = @_; - rm_rf($_) foreach grep { -e $_ } $build->get_builddir, $build->get_system_root; + + if (-e ($build->get_system_root)) { + # There shouldn't be anything mounted in the chroot, but play it safe... + umount_all_in_chroot($build); + system('sudo rm -rf ' . $build->get_system_root); + } + system('rm -rf ' . $build->get_builddir) if -e ($build->get_builddir); } ############################################################################### diff --git a/draklive b/draklive index ed2a105..92d948e 100755 --- a/draklive +++ b/draklive @@ -50,9 +50,13 @@ $::verbose = 1; sub clean { my ($build) = @_; - # Make sure no filesystems are mounted in the chroot before cleaning. - umount_all_in_chroot($build); - rm_rf($_) foreach grep { -e $_ } $build->get_builddir, $build->get_system_root; + + if (-e ($build->get_system_root)) { + # Make sure there's nothing left mounted in the chroot. + umount_all_in_chroot($build); + system('sudo rm -rf ' . $build->get_system_root); + } + system('rm -rf ' . $build->get_builddir) if -e ($build->get_builddir); } sub prepare_root { -- cgit v1.2.1