summaryrefslogtreecommitdiff
path: root/hscript/disk.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-27 08:49:03 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-27 08:49:03 -0500
commitb4215cbbf297a79dc70e8c2cde85b849033cb144 (patch)
tree01aaca55d22c672d61a5df23be59003da34e90ea /hscript/disk.cc
parentcbc3c3ead5a29ca5d4f802793042d072b9fd25fb (diff)
downloadhorizon-b4215cbbf297a79dc70e8c2cde85b849033cb144.tar.gz
horizon-b4215cbbf297a79dc70e8c2cde85b849033cb144.tar.bz2
horizon-b4215cbbf297a79dc70e8c2cde85b849033cb144.tar.xz
horizon-b4215cbbf297a79dc70e8c2cde85b849033cb144.zip
hscript: Make portable to std::filesystem OR boost::filesystem
Diffstat (limited to 'hscript/disk.cc')
-rw-r--r--hscript/disk.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/hscript/disk.cc b/hscript/disk.cc
index 784db24..f66c1e0 100644
--- a/hscript/disk.cc
+++ b/hscript/disk.cc
@@ -17,7 +17,7 @@
#ifdef HAS_INSTALL_ENV
# include <assert.h> /* assert */
# include <blkid/blkid.h> /* blkid_get_tag_value */
-# include <boost/filesystem.hpp>
+# include "util/filesystem.hh"
# include <libudev.h> /* udev_* */
# include <parted/parted.h> /* ped_* */
# include <sys/mount.h> /* mount */
@@ -30,10 +30,6 @@
using namespace Horizon::Keys;
-namespace fs = boost::filesystem;
-using boost::system::error_code;
-
-
#ifdef HAS_INSTALL_ENV
/*! Determine if _block is a valid block device.
* @param key The key associated with this test.
@@ -541,7 +537,7 @@ bool Mount::execute(ScriptOptions options) const {
/* mount */
if(!fs::exists(actual_mount, ec)) {
fs::create_directory(actual_mount, ec);
- if(ec.failed()) {
+ if(ec) {
output_error("installfile:" + std::to_string(this->lineno()),
"mount: failed to create target directory for "
+ this->mountpoint(), ec.message());
@@ -585,7 +581,7 @@ bool Mount::execute(ScriptOptions options) const {
else {
if(this->mountpoint() == "/") {
fs::create_directory("/target/etc", ec);
- if(ec.failed()) {
+ if(ec) {
output_error("installfile:" + std::to_string(this->lineno()),
"mount: failed to create /etc for target",
ec.message());
@@ -593,10 +589,11 @@ bool Mount::execute(ScriptOptions options) const {
}
fs::permissions("/target/etc",
fs::perms::owner_all |
- fs::perms::group_read | fs::perms::group_exe |
- fs::perms::others_read | fs::perms::others_exe,
+ fs::perms::group_read | fs::perms::group_exec |
+ fs::perms::others_read | fs::perms::others_exec,
+ fs::perm_options::replace,
ec);
- if(ec.failed()) {
+ if(ec) {
output_warning("installfile:" + std::to_string(this->lineno()),
"mount: failed to set permissions for target /etc",
ec.message());