summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-03 17:05:36 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-03 17:05:36 -0500
commitecac1f3bd478a81a3a960d60ed7ebc4a99375dbe (patch)
treea66e6de83450dfaaa7f1cf488854aa14783698b4
parent9a8c90211724e0804f962358653a73d87c09d253 (diff)
downloadhorizon-ecac1f3bd478a81a3a960d60ed7ebc4a99375dbe.tar.gz
horizon-ecac1f3bd478a81a3a960d60ed7ebc4a99375dbe.tar.bz2
horizon-ecac1f3bd478a81a3a960d60ed7ebc4a99375dbe.tar.xz
horizon-ecac1f3bd478a81a3a960d60ed7ebc4a99375dbe.zip
image: ISO: Try harder to umount before rm -rf
-rw-r--r--image/backends/iso.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/image/backends/iso.cc b/image/backends/iso.cc
index 7dca2e1..eee9b5a 100644
--- a/image/backends/iso.cc
+++ b/image/backends/iso.cc
@@ -15,6 +15,8 @@
#include <fstream> /* ifstream, ofstream */
#include <boost/algorithm/string.hpp>
+#include <sys/mount.h>
+
#include "basic.hh"
#include "hscript/util.hh"
#include "util/filesystem.hh"
@@ -182,15 +184,22 @@ public:
}
/* REQ: ISO.1 */
- /*if(fs::exists(this->ir_dir, ec)) {
+ if(fs::exists(this->ir_dir, ec)) {
output_info("CD backend", "removing old IR tree", this->ir_dir);
+ /* try to umount first, just in case
+ * We don't care if the call fails.
+ */
+ for(const std::string &mount : {"dev", "proc", "sys"}) {
+ const std::string path = this->ir_dir + "/target/" + mount;
+ ::umount(path.c_str());
+ }
fs::remove_all(this->ir_dir, ec);
if(ec) {
output_warning("CD backend", "could not remove IR tree",
- ec.message());*/
+ ec.message());
/* we can _try_ to proceed anyway... */
- //}
- //}
+ }
+ }
output_info("CD backend", "creating directory tree");