Skip to content

Commit db28230

Browse files
committed
Insert a default UTC timezone for Linux if none is already set
1 parent f4c25e7 commit db28230

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Tests/SwiftlyTests/E2ETests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ final class E2ETests: SwiftlyTests {
101101
env["BASH_ENV"] = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".profile").path
102102
try Swiftly.currentPlatform.runProgram(shell, "-v", "-l", "-c", "swiftly install --assume-yes latest --post-install-file=./post-install.sh", env: env)
103103

104+
// TODO: check if the user is root already before runing post install
104105
if FileManager.default.fileExists(atPath: "./post-install.sh") {
106+
#if os(Linux)
107+
if !FileManager.default.fileExists(atPath: "/etc/timezone") {
108+
// Prevent tzdata package installation from trying to prompt for the time zone
109+
try? Swiftly.currentPlatform.runProgram(shell, "echo 'Etc/UTC' > /etc/timezone")
110+
}
111+
#endif
105112
try Swiftly.currentPlatform.runProgram(shell, "./post-install.sh")
106113
}
107114

0 commit comments

Comments
 (0)