From 85a2ef3953a7aaa27bf25f8972b57aa557239b95 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Mon, 6 Nov 2023 04:27:24 +0000 Subject: [PATCH] Latest --- home/dot_config/firewall/darwin/plex.sh | 17 +++++++-------- home/dot_local/bin/executable_install-program | 21 ++++++++++++------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/home/dot_config/firewall/darwin/plex.sh b/home/dot_config/firewall/darwin/plex.sh index 125d563f..a9552934 100644 --- a/home/dot_config/firewall/darwin/plex.sh +++ b/home/dot_config/firewall/darwin/plex.sh @@ -1,11 +1,10 @@ #!/bin/bash -/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --getglobalstate -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --setglobaldescription "." -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32400 --protocol tcp -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 1900 --protocol udp -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32469 --protocol tcp -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32410 --protocol udp -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32412 --protocol udp -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32413 --protocol udp -/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32414 --protocol udp +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --setglobaldescription "." --getglobalstate +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32400 --protocol tcp +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 1900 --protocol udp +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32469 --protocol tcp +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32410 --protocol udp +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32412 --protocol udp +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32413 --protocol udp +/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32414 --protocol udp diff --git a/home/dot_local/bin/executable_install-program b/home/dot_local/bin/executable_install-program index a5b702f9..c6ff19db 100644 --- a/home/dot_local/bin/executable_install-program +++ b/home/dot_local/bin/executable_install-program @@ -1610,11 +1610,12 @@ async function addFirewallRule(rule) { if (typeof port === 'string') { log('error', logStage, `_ports rules that are equal to strings are not yet implemented on macOS (package: ${rule.packageKey})`) } else if (port.port && port.proto) { - runCommand(`Adding new service for ${rule.packageKey}`, `${socketFilterFw} --add --service "${packageName ? packageName : rule.packageKey}" --getglobalstate`) if (packageDesc) { - runCommand(`Adding description to service defined for ${rule.packageKey}`, `${socketFilterFw} --service "${packageName ? packageName : rule.packageKey}" --setglobaldescription "${packageDesc}"`) + runCommand(`Adding new service with description populated for ${rule.packageKey}`, `${socketFilterFw} --add --service "${packageName ? packageName : rule.packageKey}" --setglobaldescription "${packageDesc} --getglobalstate"`) + } else { + runCommand(`Adding new service for ${rule.packageKey}`, `${socketFilterFw} --add --service "${packageName ? packageName : rule.packageKey}" --getglobalstate`) } - runCommand(`Adding firewall rule for ${rule.packageKey}`, `${socketFilterFw} --service "${packageName ? packageName : rule.packageKey}" --add --port ${port.port} --protocol ${port.proto}`) + runCommand(`Adding firewall rule for ${rule.packageKey}`, `${socketFilterFw} --add --service "${packageName ? packageName : rule.packageKey}" --port ${port.port} --protocol ${port.proto}`) } else { log('error', logStage, `Unable to parse the firewall definition for ${rule.packageKey}`) } @@ -1842,12 +1843,18 @@ async function linkBin(installOrdersBinLink) { } } else if (binLink.preference === 'cask') { try { - const caskWhen = softwarePackages[binLink.package]['_when:cask'] - const caskDir = caskWhen.replace('! test -d ', '') - if (fileExists(caskDir)) { + const caskWhen = softwarePackages[binLink.package]['_when:cask'].replace(/blue/g, "red") + const appName = caskWhen.replace(/ && ! test -d .*/, '').replace(/! test -d "\/Applications\//, '').replace(/! test -d \/Applications\//, '').replace('"', '') + log('info', 'Bin', `Checking for existence of ${appName} application in /Applications and ~/Applications`) + if (fileExists(`/Applications/${appName}`)) { runCommand( `Adding shortcut bin link for ${binLink.package}`, - `bash -c 'mkdir -p "${process.env.HOME}/.local/bin/cask" && echo "open ${caskDir} \\\$*" > "${process.env.HOME}/.local/bin/cask/${binLink.bin}" && chmod +x "${process.env.HOME}/.local/bin/cask/${binLink.bin}"'` + `bash -c 'mkdir -p "${process.env.HOME}/.local/bin/cask" && echo "open \"${caskDir}\" \\\$*" > "${process.env.HOME}/.local/bin/cask/${binLink.bin}" && chmod +x "${process.env.HOME}/.local/bin/cask/${binLink.bin}"'` + ) + } else if(fileExists(`${process.env.HOME}/Applications/${appName}`)) { + runCommand( + `Adding shortcut bin link for ${binLink.package}`, + `bash -c 'mkdir -p "${process.env.HOME}/.local/bin/cask" && echo "open \"${process.env.HOME}/Applications/${appName}\" \\\$*" > "${process.env.HOME}/.local/bin/cask/${binLink.bin}" && chmod +x "${process.env.HOME}/.local/bin/cask/${binLink.bin}"'` ) } else { log('warn', 'Bin', `Expected Homebrew cask directory not found - ${pkg}`)