From b4215cbbf297a79dc70e8c2cde85b849033cb144 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 27 Oct 2019 08:49:03 -0500 Subject: hscript: Make portable to std::filesystem OR boost::filesystem --- hscript/meta.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'hscript/meta.cc') diff --git a/hscript/meta.cc b/hscript/meta.cc index 304b9c1..d935ca4 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -16,7 +16,7 @@ #include #include #ifdef HAS_INSTALL_ENV -# include +# include "util/filesystem.hh" #endif /* HAS_INSTALL_ENV */ #include /* access - used by tz code even in RT env */ #include "meta.hh" @@ -24,9 +24,6 @@ using namespace Horizon::Keys; -namespace fs = boost::filesystem; -using boost::system::error_code; - Key *Hostname::parseFromData(const std::string &data, int lineno, int *errors, int *) { std::regex valid_re("[A-Za-z0-9-_.]*"); @@ -293,11 +290,8 @@ bool Language::execute(ScriptOptions opts) const { << this->value() << "\"" << std::endl; lang_f.close(); - fs::permissions(lang_path, - fs::perms::owner_all | - fs::perms::group_read | fs::perms::group_exe | - fs::perms::others_read | fs::perms::others_exe, ec); - if(ec.failed()) { + fs::permissions(lang_path, rwxr_xr_x, ec); + if(ec) { output_error("installfile:" + std::to_string(this->lineno()), "language: could not set /etc/profile.d/language.sh " "as executable", ec.message()); @@ -389,7 +383,7 @@ bool Timezone::execute(ScriptOptions opts) const { error_code ec; if(fs::exists(target_zi, ec)) { fs::create_symlink(zi_path, "/target/etc/localtime", ec); - if(ec.failed()) { + if(ec) { output_error("installfile:" + std::to_string(this->lineno()), "timezone: failed to create symbolic link", ec.message()); @@ -400,7 +394,7 @@ bool Timezone::execute(ScriptOptions opts) const { /* The target doesn't have tzdata installed. We copy the zoneinfo * file from the Horizon environment to the target. */ fs::copy_file(zi_path, "/target/etc/localtime", ec); - if(ec.failed()) { + if(ec) { output_error("installfile:" + std::to_string(this->lineno()), "timezone: failed to prepare target environment", ec.message()); -- cgit v1.2.3-60-g2f50