Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added goinfre install script #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ Install
Run this command from your terminal:

```sh
curl -fsSL https://rawgit.com/kube/42homebrew/master/install.sh | zsh
curl -fsSL https://raw.githubusercontent.com/omimouni/42homebrew/master/install.sh | zsh
```

or if you want it directly into your 'goinfre'

```sh
curl -fsSL https://raw.githubusercontent.com/omimouni/42homebrew/master/install-goinfre.sh | zsh
```



Homebrew is now ready on your session.

How it works
Expand Down
64 changes: 64 additions & 0 deletions install-goinfre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

#########.
########",#:
#########',##".
##'##'## .##',##.
## ## ## # ##",#.
## ## ## ## ##'
## ## ## :##
## ## ##."

# Delete and reinstall Homebrew from Github repo
rm -rf $HOME/goinfre/.brew
git clone --depth=1 https://github.com/Homebrew/brew $HOME/goinfre/.brew

# Create .brewconfig script in home directory
cat > $HOME/.brewconfig.zsh <<EOL
# HOMEBREW CONFIG

# Add brew to path
export PATH=\$HOME/goinfre/.brew/bin:\$PATH

# Set Homebrew temporary folders
export HOMEBREW_CACHE=/tmp/\$USER/Homebrew/Caches
export HOMEBREW_TEMP=/tmp/\$USER/Homebrew/Temp

mkdir -p \$HOMEBREW_CACHE
mkdir -p \$HOMEBREW_TEMP

# If NFS session
# Symlink Locks folder in /tmp
if df -T autofs,nfs \$HOME 1>/dev/null
then
HOMEBREW_LOCKS_TARGET=/tmp/\$USER/Homebrew/Locks
HOMEBREW_LOCKS_FOLDER=\$HOME/.brew/var/homebrew

mkdir -p \$HOMEBREW_LOCKS_TARGET
mkdir -p \$HOMEBREW_LOCKS_FOLDER

# Symlink to Locks target folders
# If not already a symlink
if ! [[ -L \$HOMEBREW_LOCKS_FOLDER && -d \$HOMEBREW_LOCKS_FOLDER ]]
then
echo "Creating symlink for Locks folder"
rm -rf \$HOMEBREW_LOCKS_FOLDER
ln -s \$HOMEBREW_LOCKS_TARGET \$HOMEBREW_LOCKS_FOLDER
fi
fi
EOL

# Add .brewconfig sourcing in your .zshrc if not already present
if ! grep -q "# Load Homebrew config script" $HOME/.zshrc
then
cat >> $HOME/.zshrc <<EOL

# Load Homebrew config script
source \$HOME/.brewconfig.zsh
EOL
fi

source $HOME/.brewconfig.zsh
rehash
brew update

echo "\nPlease open a new shell to finish installation"