mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Varied macOS fixes (#2044)
* Fix selects, fix ffprobe download, fix baseurl in dev server
This commit is contained in:
committed by
GitHub
parent
7f94165769
commit
27c0fc8a18
@@ -44,6 +44,15 @@ func Download(ctx context.Context, configDirectory string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// validate that the urls contained what we needed
|
||||
executables := []string{"ffmpeg", "ffprobe"}
|
||||
for _, executable := range executables {
|
||||
_, err := os.Stat(filepath.Join(configDirectory, executable))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -76,7 +85,6 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
|
||||
}
|
||||
|
||||
// Configure where we want to download the archive
|
||||
urlExt := path.Ext(url)
|
||||
urlBase := path.Base(url)
|
||||
archivePath := filepath.Join(configDirectory, urlBase)
|
||||
_ = os.Remove(archivePath) // remove archive if it already exists
|
||||
@@ -118,7 +126,7 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
|
||||
|
||||
logger.Info("Downloading complete")
|
||||
|
||||
if urlExt == ".zip" {
|
||||
if resp.Header.Get("Content-Type") == "application/zip" {
|
||||
logger.Infof("Unzipping %s...", archivePath)
|
||||
if err := unzip(archivePath, configDirectory); err != nil {
|
||||
return err
|
||||
@@ -126,12 +134,18 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
|
||||
|
||||
// On OSX or Linux set downloaded files permissions
|
||||
if runtime.GOOS == "darwin" || runtime.GOOS == "linux" {
|
||||
if err := os.Chmod(filepath.Join(configDirectory, "ffmpeg"), 0755); err != nil {
|
||||
return err
|
||||
_, err = os.Stat(filepath.Join(configDirectory, "ffmpeg"))
|
||||
if !os.IsNotExist(err) {
|
||||
if err = os.Chmod(filepath.Join(configDirectory, "ffmpeg"), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.Chmod(filepath.Join(configDirectory, "ffprobe"), 0755); err != nil {
|
||||
return err
|
||||
_, err = os.Stat(filepath.Join(configDirectory, "ffprobe"))
|
||||
if !os.IsNotExist(err) {
|
||||
if err := os.Chmod(filepath.Join(configDirectory, "ffprobe"), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: In future possible clear xattr to allow running on osx without user intervention
|
||||
@@ -139,8 +153,6 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
|
||||
// xattr -c /path/to/binary -- xattr.Remove(path, "com.apple.quarantine")
|
||||
}
|
||||
|
||||
logger.Infof("ffmpeg and ffprobe successfully installed in %s", configDirectory)
|
||||
|
||||
} else {
|
||||
return fmt.Errorf("ffmpeg was downloaded to %s", archivePath)
|
||||
}
|
||||
@@ -152,7 +164,7 @@ func getFFMPEGURL() []string {
|
||||
var urls []string
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
urls = []string{"https://evermeet.cx/ffmpeg/ffmpeg-4.3.1.zip", "https://evermeet.cx/ffmpeg/ffprobe-4.3.1.zip"}
|
||||
urls = []string{"https://evermeet.cx/ffmpeg/getrelease/zip", "https://evermeet.cx/ffmpeg/getrelease/ffprobe/zip"}
|
||||
case "linux":
|
||||
switch runtime.GOARCH {
|
||||
case "amd64":
|
||||
|
||||
Reference in New Issue
Block a user