Change suffix to .tar.zst
This commit is contained in:
parent
9564118f40
commit
6d62b200a4
14
glue/main.go
14
glue/main.go
@ -206,9 +206,9 @@ func (p *Processor) Get(noUpdate bool) (apps.App, error) {
|
||||
|
||||
// Takes URL with an tar archive and prepares container's volume from it.
|
||||
func (p *Processor) volumeFromURL(url string, container *docker.Container) error {
|
||||
// Validation, check if url ends with tar.zstd
|
||||
if !strings.HasSuffix(url, ".tar.zstd") {
|
||||
return fmt.Errorf("archive has to end with .tar.zstd")
|
||||
// Validation, check if url ends with tar.zst
|
||||
if !strings.HasSuffix(url, ".tar.zst") {
|
||||
return fmt.Errorf("archive has to end with .tar.zst")
|
||||
}
|
||||
|
||||
volumePath := container.VolumeHostPath()
|
||||
@ -221,7 +221,7 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
|
||||
|
||||
// Download the archive
|
||||
log.Printf("%s: downloading archive from %s\n", container.App.Name, url)
|
||||
f, err := os.Create(volumePath + "/archive.tar.zstd")
|
||||
f, err := os.Create(volumePath + "/archive.tar.zst")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create archive file: %v", err)
|
||||
}
|
||||
@ -242,8 +242,8 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
|
||||
// Extract the archive
|
||||
log.Printf("%s: extracting archive\n", container.App.Name)
|
||||
|
||||
// Call tar xf archive.tar.zstd -C /volume
|
||||
cmd := exec.Command("tar", "-I", "zstd", "-xf", "archive.tar.zstd", "-C", volumePath)
|
||||
// Call tar xf archive.tar.zst -C /volume
|
||||
cmd := exec.Command("tar", "-I", "zstd", "-xf", "archive.tar.zst", "-C", volumePath)
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
log.Printf("%s: failed to extract archive: %v", container.App.Name, err)
|
||||
@ -252,7 +252,7 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
|
||||
|
||||
// Remove archive
|
||||
log.Printf("%s: removing archive\n", container.App.Name)
|
||||
err = os.Remove(volumePath + "/archive.tar.zstd")
|
||||
err = os.Remove(volumePath + "/archive.tar.zst")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to remove archive: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user