Created
March 30, 2012 22:57
-
-
Save acidprime/2257191 to your computer and use it in GitHub Desktop.
Generate Show Library LaunchAgent - inspired by https://github.com/rtrouton/rtrouton_scripts/blob/master/rtrouton_scripts/lion_show_user_library/com.company.show_library.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
#!/bin/bash | |
# This code generates a launchAgent that will unhide the Library | |
declare -xr cat="/bin/cat" | |
declare -xr defaults="/usr/bin/defaults" | |
declare -xr chown="/usr/sbin/chown" | |
declare -xr chmod="/bin/chmod" | |
declare -xr plutil="/usr/bin/plutil" | |
declare -x IDENT_KEY="com.github.acidprime.showLibrary" | |
declare -x LAUNCH_AGENT="/Library/LaunchAgents/$IDENT_KEY.plist" | |
declare -xa PROGRAM_ARGS=(/bin/bash -c '/usr/bin/chflags nohidden /Users/$USER/Library') | |
$defaults write "${LAUNCH_AGENT%%.plist}" Label "${IDENT_KEY:?}" | |
$defaults write "${LAUNCH_AGENT%%.plist}" ProgramArguments -array "${PROGRAM_ARGS[@]}" | |
$defaults write "${LAUNCH_AGENT%%.plist}" RunAtLoad -bool YES | |
$plutil -convert xml1 "${LAUNCH_AGENT:?}" | |
$chown 0:0 "${LAUNCH_AGENT:?}" | |
$chmod 744 "${LAUNCH_AGENT:?}" | |
$cat "${LAUNCH_AGENT:?}" | |
$plutil "${LAUNCH_AGENT:?}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment