Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 07:11:58 -04:00
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2021-03-25 08:37:48 -04:00
|
|
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 07:11:58 -04:00
|
|
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
|
|
|
|
|
|
package unix
|
|
|
|
|
2019-11-12 13:14:37 -05:00
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ioctl itself should not be exposed directly, but additional get/set
|
|
|
|
// functions for specific types are permissible.
|
|
|
|
|
|
|
|
// IoctlSetInt performs an ioctl operation which sets an integer value
|
|
|
|
// on fd, using the specified request number.
|
|
|
|
func IoctlSetInt(fd int, req uint, value int) error {
|
|
|
|
return ioctl(fd, req, uintptr(value))
|
|
|
|
}
|
Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 07:11:58 -04:00
|
|
|
|
2020-10-01 17:06:15 -04:00
|
|
|
// IoctlSetPointerInt performs an ioctl operation which sets an
|
|
|
|
// integer value on fd, using the specified request number. The ioctl
|
|
|
|
// argument is called with a pointer to the integer value, rather than
|
|
|
|
// passing the integer value directly.
|
|
|
|
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
|
|
|
v := int32(value)
|
|
|
|
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
|
|
|
|
}
|
|
|
|
|
Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 07:11:58 -04:00
|
|
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
|
|
|
//
|
|
|
|
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
|
|
|
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
|
|
|
// TODO: if we get the chance, remove the req parameter and
|
|
|
|
// hardcode TIOCSWINSZ.
|
2019-11-12 13:14:37 -05:00
|
|
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 07:11:58 -04:00
|
|
|
runtime.KeepAlive(value)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
|
|
|
//
|
|
|
|
// The req value will usually be TCSETA or TIOCSETA.
|
|
|
|
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
|
|
|
// TODO: if we get the chance, remove the req parameter.
|
2019-11-12 13:14:37 -05:00
|
|
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 07:11:58 -04:00
|
|
|
runtime.KeepAlive(value)
|
|
|
|
return err
|
|
|
|
}
|
2019-11-12 13:14:37 -05:00
|
|
|
|
|
|
|
// IoctlGetInt performs an ioctl operation which gets an integer value
|
|
|
|
// from fd, using the specified request number.
|
|
|
|
//
|
|
|
|
// A few ioctl requests use the return value as an output parameter;
|
|
|
|
// for those, IoctlRetInt should be used instead of this function.
|
|
|
|
func IoctlGetInt(fd int, req uint) (int, error) {
|
|
|
|
var value int
|
|
|
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
|
|
|
return value, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
|
|
|
var value Winsize
|
|
|
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
|
|
|
return &value, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
|
|
|
var value Termios
|
|
|
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
|
|
|
return &value, err
|
|
|
|
}
|