From 30e88b96ee2a63c76be8ec119b60ae26d8c73319 Mon Sep 17 00:00:00 2001 From: JoeSmithStarkers <60503487+JoeSmithStarkers@users.noreply.github.com> Date: Sat, 3 Oct 2020 16:59:23 +1000 Subject: [PATCH] Added ffmpeg/ffprobe permission correction code for linux/osx (#814) --- pkg/ffmpeg/downloader.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/ffmpeg/downloader.go b/pkg/ffmpeg/downloader.go index a00195a41..8831ae69f 100644 --- a/pkg/ffmpeg/downloader.go +++ b/pkg/ffmpeg/downloader.go @@ -76,6 +76,22 @@ func Download(configDirectory string) error { if err := unzip(archivePath, configDirectory); err != nil { return err } + + // 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 + } + + 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 + // TODO: this however may not be required. + // xattr -c /path/to/binary -- xattr.Remove(path, "com.apple.quarantine") + } + } else { return fmt.Errorf("ffmpeg was downloaded to %s", archivePath) }