mirror of
https://github.com/clearlinux/rkt.git
synced 2026-10-03 23:48:22 +00:00
Merge pull request #358 from vcaputo/handle_relative_etc_localtime
stage1/init: handle relative /etc/localtime symlinks
This commit is contained in:
+9
-1
@@ -33,15 +33,23 @@ const (
|
||||
nspawnBin = "/usr/bin/systemd-nspawn"
|
||||
// Path to the interpreter within the stage1 rootfs
|
||||
interpBin = "/usr/lib/ld-linux-x86-64.so.2"
|
||||
// Path to the localtime file/symlink in host
|
||||
localtimePath = "/etc/localtime"
|
||||
)
|
||||
|
||||
// mirrorLocalZoneInfo tries to reproduce the /etc/localtime target in stage1/ to satisfy systemd-nspawn
|
||||
func mirrorLocalZoneInfo(root string) {
|
||||
zif, err := os.Readlink("/etc/localtime")
|
||||
zif, err := os.Readlink(localtimePath)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// On some systems /etc/localtime is a relative symlink, make it absolute
|
||||
if !filepath.IsAbs(zif) {
|
||||
zif = filepath.Join(filepath.Dir(localtimePath), zif)
|
||||
zif = filepath.Clean(zif)
|
||||
}
|
||||
|
||||
src, err := os.Open(zif)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user