Created
October 1, 2011 17:34
-
-
Save stephenmcgruer/1256381 to your computer and use it in GitHub Desktop.
Shell script to set up a symlink to tmp for google chrome's cache.
This file contains hidden or 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 shell script sets up a symlink to tmp for google chrome's | |
# cache, if one doesnt already exist. Useful due to the size of | |
# chrome's cache. | |
# One downside is that you will end up with a different cache | |
# on each computer you use - but this isn't a massive problem tbh. | |
ACTUAL=/tmp/$USER/cache/google-chrome | |
SYMLINK=~/.cache/google-chrome | |
mkdir -p $ACTUAL | |
chmod 700 /tmp/$USER | |
if [ $? -ne 0 ]; then | |
echo "Unable to restrict access to folder /tmp/$USER" | |
echo "The most probable cause is that someone else has already created this folder before you." | |
echo "Try changing the ACTUAL variable in the shell script." | |
exit 1 | |
fi | |
if [ -e $SYMLINK ]; then | |
# Directory exists - is it a symlink? | |
if [ -L $SYMLINK ]; then | |
# We're done! | |
exit 0 | |
else | |
# Try and delete it. | |
rm -rf $SYMLINK | |
if [ $? -ne 0 ]; then | |
# Bugger. | |
echo "Unable to delete chrome cache folder." | |
echo "Shut down any running instance of chrome and try running the script again." | |
exit 1 | |
fi | |
fi | |
fi | |
# Okay, need to create symlink. | |
ln -s $ACTUAL $SYMLINK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good point Chris, I'll get that fixed.
Update: Fixed.
Updated update: Really fixed. :)