aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2009-07-28 01:54:45 -0700
committerMax Howell2009-08-02 01:25:01 +0100
commit7478ff7804cb0d9a1e777360fdd67b7a32c353f1 (patch)
treeab8f17a6d885f8538eb1435ec322497dd1def7c3 /Library
parent58ba5f9df62f615a301ce80d593b4bb523bee74f (diff)
downloadbrew-7478ff7804cb0d9a1e777360fdd67b7a32c353f1.tar.bz2
Ensure that the Cellar exists when symlinking
Only remove brew symlinks w/ selflink.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/selflink.sh21
1 files changed, 17 insertions, 4 deletions
diff --git a/Library/Contributions/selflink.sh b/Library/Contributions/selflink.sh
index 285af4f86..c99f3956f 100755
--- a/Library/Contributions/selflink.sh
+++ b/Library/Contributions/selflink.sh
@@ -8,13 +8,26 @@ fi
source_base=`pwd`
if [[ $mode == install ]]; then
+ # Ensure that the Cellar exists
+ if [[ ! -e "$source_base/Cellar" ]] ; then
+ mkdir -p "$source_base/Cellar"
+ fi
+
ln -s "$source_base/bin/brew" "/usr/local/bin/brew";
ln -s "$source_base/Library" "/usr/local/Library";
ln -s "$source_base/Cellar" "/usr/local/Cellar";
-elif [[ $mode == undo ]]; then
- rm "/usr/local/bin/brew"
- rm "/usr/local/Library"
- rm "/usr/local/Cellar"
+elif [[ $mode == undo ]]; then
+ if [[ -h "/usr/local/bin/brew" ]] ; then
+ rm "/usr/local/bin/brew"
+ fi
+
+ if [[ -h "/usr/local/Library" ]] ; then
+ rm "/usr/local/Library"
+ fi
+
+ if [[ -h "/usr/local/Cellar" ]] ; then
+ rm "/usr/local/Cellar"
+ fi
else
echo "Unknown command: $mode";
echo "\tselflink.sh [install] >> symlinks to /usr/local"