Skip to content

Instantly share code, notes, and snippets.

@johngrinalds
Last active June 23, 2024 21:47
Show Gist options
  • Save johngrinalds/e1eba94db0218256a766cf0e011b8904 to your computer and use it in GitHub Desktop.
Save johngrinalds/e1eba94db0218256a766cf0e011b8904 to your computer and use it in GitHub Desktop.
setup.sh
#!/bin/bash
# setup.sh
# focusmanager
#
# Created by John Grinalds on 6/22/24.
#
# Check if a user argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 USER"
exit 1
fi
USER=$1
# Backup the /etc/hosts file
sudo cp /etc/hosts /etc/hosts.backup
# Create a symbolic link for the hosts file in the user's focusmanager directory
sudo ln -f /etc/hosts /Users/$USER/Library/Containers/com.johngrinalds.focusmanager/Data/Documents/focusmanager-hosts
# Change the ownership of the focusmanager-hosts file to the specified user
sudo chown $USER:staff /Users/$USER/Library/Containers/com.johngrinalds.focusmanager/Data/Documents/focusmanager-hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment