summaryrefslogtreecommitdiff
path: root/hscript/meta.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-29 09:53:58 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-29 09:53:58 -0500
commit38a34471c532a3034bac52692eb2261c05e3d730 (patch)
treebe71bfbcfc25bd7080a5ce700173ec92d3261786 /hscript/meta.cc
parent073961cfff9e249d92c240eabcf5d24a7b4a7bab (diff)
downloadhorizon-38a34471c532a3034bac52692eb2261c05e3d730.tar.gz
horizon-38a34471c532a3034bac52692eb2261c05e3d730.tar.bz2
horizon-38a34471c532a3034bac52692eb2261c05e3d730.tar.xz
horizon-38a34471c532a3034bac52692eb2261c05e3d730.zip
hscript: Timezone: Always remove existing localtime
Otherwise, if the target doesn't have tzdata installed, an existing /etc/localtime file won't be removed and we can hit an error.
Diffstat (limited to 'hscript/meta.cc')
-rw-r--r--hscript/meta.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc
index dc17290..ff39d4a 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -491,9 +491,9 @@ bool Timezone::execute() const {
std::string target_zi = script->targetDirectory() + zi_path;
std::string target_lt = script->targetDirectory() + "/etc/localtime";
error_code ec;
- if(fs::exists(target_zi, ec)) {
- if(fs::exists(target_lt, ec)) fs::remove(target_lt, ec);
+ if(fs::exists(target_lt, ec)) fs::remove(target_lt, ec);
+ if(fs::exists(target_zi, ec)) {
fs::create_symlink(zi_path, target_lt, ec);
if(ec) {
output_error(pos, "timezone: failed to create symbolic link",