Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jason committed Sep 9, 2019
1 parent 461e290 commit faf78f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2019090422
2019090923
14 changes: 12 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,15 +847,25 @@ func Untar(file string, folder string) *Error {
if strings.HasPrefix(header.Linkname, "/") {
os.Symlink(fmt.Sprintf("%s%s", strings.TrimSuffix(folder, "/"), header.Linkname), target)
} else {
os.Symlink(header.Linkname, target)
if strings.ContainsAny(header.Linkname, "/") {
os.Symlink(fmt.Sprintf("%s%s", folder, header.Linkname), target)
} else {
os.Symlink(header.Linkname, target)
}
}

//we should avoid of creating hard link
case tar.TypeLink:
if strings.HasPrefix(header.Linkname, "/") {
os.Symlink(fmt.Sprintf("%s%s", strings.TrimSuffix(folder, "/"), header.Linkname), target)
} else {
os.Symlink(header.Linkname, target)
//for some hard links they link to usr/bin/xxx
if strings.ContainsAny(header.Linkname, "/") {
os.Symlink(fmt.Sprintf("%s%s", folder, header.Linkname), target)
} else {
//only works on linking to the file inside the same folder
os.Symlink(header.Linkname, target)
}
}
}
}
Expand Down

0 comments on commit faf78f1

Please sign in to comment.