Created
March 29, 2017 15:03
-
-
Save gks/2d42dfcbd5d5b2452b3bef8b66d28640 to your computer and use it in GitHub Desktop.
1Password's Repair Permissions In Diagnostics Utility
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
- (IBAction)resetFolderPermissions:(id)sender { | |
setenv("F1", [[@"~/Library/Application Support/1Password" stringByExpandingTildeInPath] UTF8String], 1); | |
setenv("F2", [[@"~/Library/ScriptingAdditions" stringByExpandingTildeInPath] UTF8String], 1); | |
setenv("F3", [[@"~/Library/LaunchAgents" stringByExpandingTildeInPath] UTF8String], 1); | |
setenv("THEUSER", [NSUserName() UTF8String], 1); | |
NSString *script = @"mkdir \"$F1\";chmod -R u+rw,-t \"$F1\"; chmod -R -N \"$F1\"; chown -R \"$THEUSER:staff\" \"$F1\";mkdir \"$F2\";chmod 700 \"$F2\";chown \"$THEUSER:staff\" \"$F2\";chmod -a \"everyone deny add_subdirectory\" \"$F2\";chmod -a \"everyone deny delete_child\" \"$F2\";chmod -a \"everyone deny list\" \"$F2\";chmod -R u+rw,-t \"$F2/1Password Addition.osax\";chmod -R u+rw,-t \"$F2/1Password Addition Leopard.osax\";mkdir \"$F3\";chmod 700 \"$F3\";chown \"$THEUSER:staff\" \"$F3\";chmod -a \"everyone deny delete_child\" \"$F3\";chmod -a \"everyone deny add_file\" \"$F3\";chmod -a \"everyone deny list\" \"$F3\";chmod 644 \"$F3/ws.agile.1PasswordAgent.plist\";chmod -N \"$F3/ws.agile.1PasswordAgent.plist\""; | |
BOOL result = runShellWithAuthorization(NSLocalizedString(@"Please enter your Mac OS X password.\n\nFolder permissions will be reset. ", @"prompt"), script); | |
if (result) { | |
NSRunAlertPanel(NSLocalizedString(@"The folder permissions have been reset successfully.", @"info"), NSLocalizedString(@"Please restart 1Password.", @"info"), nil, nil, nil);; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment