Fix selflink script.

This commit is contained in:
Adam Vandenberg 2009-12-04 22:33:09 -08:00 committed by Max Howell
parent 4ce19ae2d7
commit 4731add213

View File

@ -17,30 +17,25 @@ source_base=`pwd`
if [[ $mode == install ]]; then if [[ $mode == install ]]; then
# Ensure that the Cellar exists -- otherwise Homebrew breaks # Ensure that the Cellar exists -- otherwise Homebrew breaks
if [[ ! -e "$source_base/Cellar" ]] ; then if [[ ! -e "$source_base/Cellar" ]] ; then
mkdir -p "$source_base/Cellar" mkdir -p "$install_base/Cellar"
fi fi
if [[ ! -e "$install_base/bin" ]] ; then if [[ ! -e "$source_base/bin" ]] ; then
mkdir -p $install_base/bin mkdir -p $install_base/bin
fi fi
ln -s "$source_base/bin/brew" "$install_base/bin/brew"; ln -s "$source_base/bin/brew" "$install_base/bin/brew";
ln -s "$source_base/Library" "$install_base/Library";
ln -s "$source_base/Cellar" "$install_base/Cellar"; ln -s "$source_base/Cellar" "$install_base/Cellar";
elif [[ $mode == undo ]]; then elif [[ $mode == undo ]]; then
if [[ -h "$install_base/bin/brew" ]] ; then if [[ -h "$install_base/bin/brew" ]] ; then
rm "$install_base/bin/brew" rm "$install_base/bin/brew"
fi fi
if [[ -h "$install_base/Library" ]] ; then
rm "$install_base/Library"
fi
if [[ -h "$install_base/Cellar" ]] ; then if [[ -h "$install_base/Cellar" ]] ; then
rm "$install_base/Cellar" rm "$install_base/Cellar"
fi fi
else else
echo "Unknown command: $mode"; echo "Unknown command: $mode";
echo "\tselflink.sh [install] >> symlinks to $install_base" echo " selflink.sh [install] >> symlinks to $install_base"
echo "\tselflink.sh undo >> removes symlinks from $install_base" echo " selflink.sh undo >> removes symlinks from $install_base"
fi fi