diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-27 08:49:03 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-27 08:49:03 -0500 |
commit | b4215cbbf297a79dc70e8c2cde85b849033cb144 (patch) | |
tree | 01aaca55d22c672d61a5df23be59003da34e90ea /hscript/meta.cc | |
parent | cbc3c3ead5a29ca5d4f802793042d072b9fd25fb (diff) | |
download | horizon-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/meta.cc')
-rw-r--r-- | hscript/meta.cc | 16 |
1 files changed, 5 insertions, 11 deletions
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 <set> #include <sstream> #ifdef HAS_INSTALL_ENV -# include <boost/filesystem.hpp> +# include "util/filesystem.hh" #endif /* HAS_INSTALL_ENV */ #include <unistd.h> /* 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()); |