blob: 7a33c2c79c4187f88d526f0044da683a873fd245 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/usr/bin/env bash
# This script links your clone into $install_base, so you can keep the .git
# directory out of the way. Default for no parameters is /usr/local
mode=$1
if [[ -z $mode ]]; then
mode="install"
fi
install_base=$2
if [[ -z $install_base ]]; then
install_base="/usr/local"
fi
source_base=`pwd`
if [[ $mode == install ]]; then
# Ensure that the Cellar exists -- otherwise Homebrew breaks
if [[ ! -e "$source_base/Cellar" ]] ; then
mkdir -p "$install_base/Cellar"
fi
if [[ ! -e "$source_base/bin" ]] ; then
mkdir -p $install_base/bin
fi
ln -s "$source_base/bin/brew" "$install_base/bin/brew";
ln -s "$source_base/Cellar" "$install_base/Cellar";
elif [[ $mode == undo ]]; then
if [[ -h "$install_base/bin/brew" ]] ; then
rm "$install_base/bin/brew"
fi
if [[ -h "$install_base/Cellar" ]] ; then
rm "$install_base/Cellar"
fi
else
echo "Unknown command: $mode";
echo " selflink.sh [install] >> symlinks to $install_base"
echo " selflink.sh undo >> removes symlinks from $install_base"
fi
|