commit
44d2198a1b
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -101,10 +102,21 @@ func init() {
|
||||||
// can leave the source file where it is & tell us where it is.
|
// can leave the source file where it is & tell us where it is.
|
||||||
Copy: true,
|
Copy: true,
|
||||||
}
|
}
|
||||||
|
getters["smb"] = &getter.FileGetter{
|
||||||
|
Copy: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string) (string, error) {
|
func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string) (string, error) {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// Check that the user specified a UNC path, and promote it to an smb:// uri.
|
||||||
|
if strings.HasPrefix(source, "\\\\") && len(source) > 2 && source[2] != '?' {
|
||||||
|
source = filepath.ToSlash(source[2:])
|
||||||
|
source = fmt.Sprintf("smb://%s", source)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u, err := urlhelper.Parse(source)
|
u, err := urlhelper.Parse(source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("url parse: %s", err)
|
return "", fmt.Errorf("url parse: %s", err)
|
||||||
|
|
Loading…
Reference in New Issue