-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 22bc1f9
Showing
7 changed files
with
488 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.pkg | ||
.DS_Store | ||
build | ||
/bigsurblocker-munkipkg/payload/usr/local/bin/bigsurblocker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Big Sur Blocker | ||
|
||
Detect when `Install macOS Big Sur.app` installer application has launched, terminate the process and display an alert. | ||
|
||
This project is heavily inspired by Erik Berglund's [AppBlocker](https://github.com/erikberglund/AppBlocker). It uses the same underlying idea of registering and listening for NSWorkspace notifications when app has started up and then checking the CFBundleIdentifier of the launched app to identify a Big Sur installer launch. | ||
|
||
# Requirements | ||
|
||
The binary requires at least macOS 10.9, however I've only tested this on macOS 10.13 and 10.14. | ||
|
||
# Configuration | ||
|
||
All configuration is optional. If needed, the alert title and text can be set through a configuration profile. Use `com.hjuutilainen.bigsurblocker` as the domain and `AlertTitle` and `AlertText` as the keys. | ||
|
||
# Installation | ||
|
||
Download the prebuilt package and deploy with your favorite method. The package is signed and notarized. | ||
|
||
# Uninstall | ||
|
||
To fully uninstall `bigsurblocker`, run the following (as root or with sudo): | ||
|
||
``` | ||
current_user_uid=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/UID :/ && ! /loginwindow/ { print $3 }' ) | ||
launchd_item_path="/Library/LaunchAgents/com.hjuutilainen.bigsurblocker.plist" | ||
launchctl bootout gui/${current_user_uid} "${launchd_item_path}" | ||
rm -f /Library/LaunchAgents/com.hjuutilainen.bigsurblocker.plist | ||
rm -f /usr/local/bin/bigsurblocker | ||
pkgutil --forget com.hjuutilainen.bigsurblocker | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "bigsurblocker-${version}.pkg", | ||
"version": "20201021", | ||
"identifier": "com.hjuutilainen.bigsurblocker", | ||
"postinstall_action": "none", | ||
"suppress_bundle_relocation": true, | ||
"distribution_style": false, | ||
"install_location": "/", | ||
"ownership": "recommended", | ||
"signing_info": { | ||
"identity": "Developer ID Installer: Hannes Juutilainen (8XXWJ76X9Y)", | ||
"timestamp": true | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
bigsurblocker-munkipkg/payload/Library/LaunchAgents/com.hjuutilainen.bigsurblocker.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>com.hjuutilainen.bigsurblocker</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>/usr/local/bin/bigsurblocker</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true /> | ||
<key>KeepAlive</key> | ||
<true /> | ||
<key>LimitLoadToSessionType</key> | ||
<string>Aqua</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
if [[ $3 != "/" ]]; then | ||
exit 0 | ||
fi | ||
|
||
launchd_item_path="/Library/LaunchAgents/com.hjuutilainen.bigsurblocker.plist" | ||
current_user_uid=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/UID :/ && ! /loginwindow/ { print $3 }' ) | ||
|
||
launchctl bootout gui/${current_user_uid} "${launchd_item_path}" > /dev/null 2>&1 | ||
launchctl bootstrap gui/${current_user_uid} "${launchd_item_path}" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,293 @@ | ||
// !$*UTF8*$! | ||
{ | ||
archiveVersion = 1; | ||
classes = { | ||
}; | ||
objectVersion = 50; | ||
objects = { | ||
|
||
/* Begin PBXBuildFile section */ | ||
265C5173253C6D6700D868C4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 265C5172253C6D6700D868C4 /* main.m */; }; | ||
/* End PBXBuildFile section */ | ||
|
||
/* Begin PBXCopyFilesBuildPhase section */ | ||
265C516D253C6D6700D868C4 /* CopyFiles */ = { | ||
isa = PBXCopyFilesBuildPhase; | ||
buildActionMask = 2147483647; | ||
dstPath = /usr/share/man/man1/; | ||
dstSubfolderSpec = 0; | ||
files = ( | ||
); | ||
runOnlyForDeploymentPostprocessing = 1; | ||
}; | ||
/* End PBXCopyFilesBuildPhase section */ | ||
|
||
/* Begin PBXFileReference section */ | ||
265C516F253C6D6700D868C4 /* bigsurblocker */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = bigsurblocker; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
265C5172253C6D6700D868C4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; | ||
/* End PBXFileReference section */ | ||
|
||
/* Begin PBXFrameworksBuildPhase section */ | ||
265C516C253C6D6700D868C4 /* Frameworks */ = { | ||
isa = PBXFrameworksBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
/* End PBXFrameworksBuildPhase section */ | ||
|
||
/* Begin PBXGroup section */ | ||
265C5166253C6D6700D868C4 = { | ||
isa = PBXGroup; | ||
children = ( | ||
265C5171253C6D6700D868C4 /* bigsurblocker */, | ||
265C5170253C6D6700D868C4 /* Products */, | ||
); | ||
sourceTree = "<group>"; | ||
}; | ||
265C5170253C6D6700D868C4 /* Products */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
265C516F253C6D6700D868C4 /* bigsurblocker */, | ||
); | ||
name = Products; | ||
sourceTree = "<group>"; | ||
}; | ||
265C5171253C6D6700D868C4 /* bigsurblocker */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
265C5172253C6D6700D868C4 /* main.m */, | ||
); | ||
path = bigsurblocker; | ||
sourceTree = "<group>"; | ||
}; | ||
/* End PBXGroup section */ | ||
|
||
/* Begin PBXNativeTarget section */ | ||
265C516E253C6D6700D868C4 /* bigsurblocker */ = { | ||
isa = PBXNativeTarget; | ||
buildConfigurationList = 265C5176253C6D6700D868C4 /* Build configuration list for PBXNativeTarget "bigsurblocker" */; | ||
buildPhases = ( | ||
265C516B253C6D6700D868C4 /* Sources */, | ||
265C516C253C6D6700D868C4 /* Frameworks */, | ||
265C516D253C6D6700D868C4 /* CopyFiles */, | ||
); | ||
buildRules = ( | ||
); | ||
dependencies = ( | ||
); | ||
name = bigsurblocker; | ||
productName = bigsurblocker; | ||
productReference = 265C516F253C6D6700D868C4 /* bigsurblocker */; | ||
productType = "com.apple.product-type.tool"; | ||
}; | ||
/* End PBXNativeTarget section */ | ||
|
||
/* Begin PBXProject section */ | ||
265C5167253C6D6700D868C4 /* Project object */ = { | ||
isa = PBXProject; | ||
attributes = { | ||
LastUpgradeCheck = 1220; | ||
TargetAttributes = { | ||
265C516E253C6D6700D868C4 = { | ||
CreatedOnToolsVersion = 12.2; | ||
}; | ||
}; | ||
}; | ||
buildConfigurationList = 265C516A253C6D6700D868C4 /* Build configuration list for PBXProject "bigsurblocker" */; | ||
compatibilityVersion = "Xcode 9.3"; | ||
developmentRegion = en; | ||
hasScannedForEncodings = 0; | ||
knownRegions = ( | ||
en, | ||
Base, | ||
); | ||
mainGroup = 265C5166253C6D6700D868C4; | ||
productRefGroup = 265C5170253C6D6700D868C4 /* Products */; | ||
projectDirPath = ""; | ||
projectRoot = ""; | ||
targets = ( | ||
265C516E253C6D6700D868C4 /* bigsurblocker */, | ||
); | ||
}; | ||
/* End PBXProject section */ | ||
|
||
/* Begin PBXSourcesBuildPhase section */ | ||
265C516B253C6D6700D868C4 /* Sources */ = { | ||
isa = PBXSourcesBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
265C5173253C6D6700D868C4 /* main.m in Sources */, | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
/* End PBXSourcesBuildPhase section */ | ||
|
||
/* Begin XCBuildConfiguration section */ | ||
265C5174253C6D6700D868C4 /* Debug */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ALWAYS_SEARCH_USER_PATHS = NO; | ||
CLANG_ANALYZER_NONNULL = YES; | ||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | ||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | ||
CLANG_CXX_LIBRARY = "libc++"; | ||
CLANG_ENABLE_MODULES = YES; | ||
CLANG_ENABLE_OBJC_ARC = YES; | ||
CLANG_ENABLE_OBJC_WEAK = YES; | ||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
CLANG_WARN_BOOL_CONVERSION = YES; | ||
CLANG_WARN_COMMA = YES; | ||
CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
CLANG_WARN_EMPTY_BODY = YES; | ||
CLANG_WARN_ENUM_CONVERSION = YES; | ||
CLANG_WARN_INFINITE_RECURSION = YES; | ||
CLANG_WARN_INT_CONVERSION = YES; | ||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | ||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | ||
CLANG_WARN_UNREACHABLE_CODE = YES; | ||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
COPY_PHASE_STRIP = NO; | ||
DEBUG_INFORMATION_FORMAT = dwarf; | ||
ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
ENABLE_TESTABILITY = YES; | ||
GCC_C_LANGUAGE_STANDARD = gnu11; | ||
GCC_DYNAMIC_NO_PIC = NO; | ||
GCC_NO_COMMON_BLOCKS = YES; | ||
GCC_OPTIMIZATION_LEVEL = 0; | ||
GCC_PREPROCESSOR_DEFINITIONS = ( | ||
"DEBUG=1", | ||
"$(inherited)", | ||
); | ||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
GCC_WARN_UNUSED_FUNCTION = YES; | ||
GCC_WARN_UNUSED_VARIABLE = YES; | ||
MACOSX_DEPLOYMENT_TARGET = 11.0; | ||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | ||
MTL_FAST_MATH = YES; | ||
ONLY_ACTIVE_ARCH = YES; | ||
SDKROOT = macosx; | ||
}; | ||
name = Debug; | ||
}; | ||
265C5175253C6D6700D868C4 /* Release */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ALWAYS_SEARCH_USER_PATHS = NO; | ||
CLANG_ANALYZER_NONNULL = YES; | ||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | ||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | ||
CLANG_CXX_LIBRARY = "libc++"; | ||
CLANG_ENABLE_MODULES = YES; | ||
CLANG_ENABLE_OBJC_ARC = YES; | ||
CLANG_ENABLE_OBJC_WEAK = YES; | ||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
CLANG_WARN_BOOL_CONVERSION = YES; | ||
CLANG_WARN_COMMA = YES; | ||
CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
CLANG_WARN_EMPTY_BODY = YES; | ||
CLANG_WARN_ENUM_CONVERSION = YES; | ||
CLANG_WARN_INFINITE_RECURSION = YES; | ||
CLANG_WARN_INT_CONVERSION = YES; | ||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | ||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | ||
CLANG_WARN_UNREACHABLE_CODE = YES; | ||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
COPY_PHASE_STRIP = NO; | ||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
ENABLE_NS_ASSERTIONS = NO; | ||
ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
GCC_C_LANGUAGE_STANDARD = gnu11; | ||
GCC_NO_COMMON_BLOCKS = YES; | ||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
GCC_WARN_UNUSED_FUNCTION = YES; | ||
GCC_WARN_UNUSED_VARIABLE = YES; | ||
MACOSX_DEPLOYMENT_TARGET = 11.0; | ||
MTL_ENABLE_DEBUG_INFO = NO; | ||
MTL_FAST_MATH = YES; | ||
SDKROOT = macosx; | ||
}; | ||
name = Release; | ||
}; | ||
265C5177253C6D6700D868C4 /* Debug */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
CODE_SIGN_IDENTITY = "Developer ID Application"; | ||
CODE_SIGN_STYLE = Manual; | ||
DEVELOPMENT_TEAM = 8XXWJ76X9Y; | ||
DSTROOT = $SRCROOT/build/pkgroot; | ||
ENABLE_HARDENED_RUNTIME = YES; | ||
MACOSX_DEPLOYMENT_TARGET = 10.9; | ||
PRODUCT_BUNDLE_IDENTIFIER = com.hjuutilainen.bigsurblocker; | ||
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
PROVISIONING_PROFILE_SPECIFIER = ""; | ||
}; | ||
name = Debug; | ||
}; | ||
265C5178253C6D6700D868C4 /* Release */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
CODE_SIGN_IDENTITY = "Developer ID Application"; | ||
CODE_SIGN_STYLE = Manual; | ||
DEVELOPMENT_TEAM = 8XXWJ76X9Y; | ||
DSTROOT = $SRCROOT/build/pkgroot; | ||
ENABLE_HARDENED_RUNTIME = YES; | ||
MACOSX_DEPLOYMENT_TARGET = 10.9; | ||
PRODUCT_BUNDLE_IDENTIFIER = com.hjuutilainen.bigsurblocker; | ||
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
PROVISIONING_PROFILE_SPECIFIER = ""; | ||
}; | ||
name = Release; | ||
}; | ||
/* End XCBuildConfiguration section */ | ||
|
||
/* Begin XCConfigurationList section */ | ||
265C516A253C6D6700D868C4 /* Build configuration list for PBXProject "bigsurblocker" */ = { | ||
isa = XCConfigurationList; | ||
buildConfigurations = ( | ||
265C5174253C6D6700D868C4 /* Debug */, | ||
265C5175253C6D6700D868C4 /* Release */, | ||
); | ||
defaultConfigurationIsVisible = 0; | ||
defaultConfigurationName = Release; | ||
}; | ||
265C5176253C6D6700D868C4 /* Build configuration list for PBXNativeTarget "bigsurblocker" */ = { | ||
isa = XCConfigurationList; | ||
buildConfigurations = ( | ||
265C5177253C6D6700D868C4 /* Debug */, | ||
265C5178253C6D6700D868C4 /* Release */, | ||
); | ||
defaultConfigurationIsVisible = 0; | ||
defaultConfigurationName = Release; | ||
}; | ||
/* End XCConfigurationList section */ | ||
}; | ||
rootObject = 265C5167253C6D6700D868C4 /* Project object */; | ||
} |
Oops, something went wrong.