|
|
@ -20,6 +20,7 @@ func (fs *Filesystem) resolveVars(p string) (string, error) {
|
|
|
|
const pathVar = "${PATH}/"
|
|
|
|
const pathVar = "${PATH}/"
|
|
|
|
const homeVar = "${HOME}"
|
|
|
|
const homeVar = "${HOME}"
|
|
|
|
const uidVar = "${UID}"
|
|
|
|
const uidVar = "${UID}"
|
|
|
|
|
|
|
|
const userVar = "${USER}"
|
|
|
|
|
|
|
|
|
|
|
|
switch {
|
|
|
|
switch {
|
|
|
|
case strings.HasPrefix(p, pathVar):
|
|
|
|
case strings.HasPrefix(p, pathVar):
|
|
|
@ -32,8 +33,11 @@ func (fs *Filesystem) resolveVars(p string) (string, error) {
|
|
|
|
case strings.HasPrefix(p, homeVar):
|
|
|
|
case strings.HasPrefix(p, homeVar):
|
|
|
|
return path.Join(fs.user.HomeDir, p[len(homeVar):]), nil
|
|
|
|
return path.Join(fs.user.HomeDir, p[len(homeVar):]), nil
|
|
|
|
|
|
|
|
|
|
|
|
case strings.HasPrefix(p, uidVar):
|
|
|
|
case strings.Contains(p, uidVar):
|
|
|
|
return strings.Replace(p, uidVar, fs.userID, -1), nil
|
|
|
|
return strings.Replace(p, uidVar, fs.user.Uid, -1), nil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case strings.Contains(p, userVar):
|
|
|
|
|
|
|
|
return strings.Replace(p, userVar, fs.user.Username, -1), nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return p, nil
|
|
|
|
return p, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|