Added ffmpeg/ffprobe permission correction code for linux/osx (#814)

This commit is contained in:
JoeSmithStarkers 2020-10-03 16:59:23 +10:00 committed by GitHub
parent 8866670e53
commit 30e88b96ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -76,6 +76,22 @@ func Download(configDirectory string) error {
if err := unzip(archivePath, configDirectory); err != nil { if err := unzip(archivePath, configDirectory); err != nil {
return err 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 { } else {
return fmt.Errorf("ffmpeg was downloaded to %s", archivePath) return fmt.Errorf("ffmpeg was downloaded to %s", archivePath)
} }