Skip to content

Commit

Permalink
macOS version check robustness. (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhjd authored Oct 15, 2024
1 parent 21e9549 commit 0e51b44
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
18 changes: 11 additions & 7 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const get = require("simple-get");
const tar = require("tar");

const DOWNLOAD_RETRY_ATTEMPTS = 2;
const MACOS_MINIMUM_SUPPORTED_VERSION = 23;
const MACOS_MINIMUM_SUPPORTED_RELEASE = "Sonoma";

function targetFfmpegRelease() {

Expand Down Expand Up @@ -222,18 +224,20 @@ async function install() {
// Ensure the FFmpeg npm cache directory exists.
ensureFfmpegCacheDir();

// Ensure we don't support versions of macOS that are too old.
if(os.platform() === "darwin" && parseInt(os.release()) < MACOS_MINIMUM_SUPPORTED_VERSION) {

console.error("ffmpeg-for-homebridge: macOS versions older than " + MACOS_MINIMUM_SUPPORTED_RELEASE + " are not supported, you will need to install a working version of FFmpeg manually.");

process.exit(0);
}

// Determine the download file name for the current platform.
const ffmpegDownloadFileName = await getDownloadFileName();

if(!ffmpegDownloadFileName) {

if(os.platform() === "darwin" && parseInt(os.release()) < 24) {

console.log("ffmpeg-for-homebridge: macOS versions older than 15 (Sequoia) are not supported, you will need to install a working version of FFmpeg manually.");
} else {

console.log("ffmpeg-for-homebridge: %s %s is not supported, you will need to install a working version of FFmpeg manually.", os.platform, process.arch);
}
console.error("ffmpeg-for-homebridge: %s %s is not supported, you will need to install a working version of FFmpeg manually.", os.platform, process.arch);

process.exit(0);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffmpeg-for-homebridge",
"version": "2.1.5",
"version": "2.1.6",
"description": "Static FFmpeg binaries for Homebridge with support for audio (libfdk-aac) and hardware encoding (h264_v4l2m2m and h264_qsv).",
"author": {
"name": "The Homebridge Team",
Expand Down

0 comments on commit 0e51b44

Please sign in to comment.