This commit is contained in:
Brian Zalewski 2023-11-06 04:27:24 +00:00
parent 09fb2fdbb7
commit 85a2ef3953
2 changed files with 22 additions and 16 deletions

View file

@ -1,11 +1,10 @@
#!/bin/bash #!/bin/bash
/usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --getglobalstate /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --setglobaldescription "." --getglobalstate
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --setglobaldescription "." /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32400 --protocol tcp
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32400 --protocol tcp /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 1900 --protocol udp
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 1900 --protocol udp /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32469 --protocol tcp
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32469 --protocol tcp /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32410 --protocol udp
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32410 --protocol udp /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32412 --protocol udp
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32412 --protocol udp /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32413 --protocol udp
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32413 --protocol udp /usr/libexec/ApplicationFirewall/socketfilterfw --add --service "Plex" --port 32414 --protocol udp
/usr/libexec/ApplicationFirewall/socketfilterfw --service "Plex" --add --port 32414 --protocol udp

View file

@ -1610,11 +1610,12 @@ async function addFirewallRule(rule) {
if (typeof port === 'string') { if (typeof port === 'string') {
log('error', logStage, `_ports rules that are equal to strings are not yet implemented on macOS (package: ${rule.packageKey})`) 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) { } else if (port.port && port.proto) {
runCommand(`Adding new service for ${rule.packageKey}`, `${socketFilterFw} --add --service "${packageName ? packageName : rule.packageKey}" --getglobalstate`)
if (packageDesc) { 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 { } else {
log('error', logStage, `Unable to parse the firewall definition for ${rule.packageKey}`) 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') { } else if (binLink.preference === 'cask') {
try { try {
const caskWhen = softwarePackages[binLink.package]['_when:cask'] const caskWhen = softwarePackages[binLink.package]['_when:cask'].replace(/blue/g, "red")
const caskDir = caskWhen.replace('! test -d ', '') const appName = caskWhen.replace(/ && ! test -d .*/, '').replace(/! test -d "\/Applications\//, '').replace(/! test -d \/Applications\//, '').replace('"', '')
if (fileExists(caskDir)) { log('info', 'Bin', `Checking for existence of ${appName} application in /Applications and ~/Applications`)
if (fileExists(`/Applications/${appName}`)) {
runCommand( runCommand(
`Adding shortcut bin link for ${binLink.package}`, `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 { } else {
log('warn', 'Bin', `Expected Homebrew cask directory not found - ${pkg}`) log('warn', 'Bin', `Expected Homebrew cask directory not found - ${pkg}`)