Skip to content

Commit

Permalink
converted to UNIX with dos2unix
Browse files Browse the repository at this point in the history
  • Loading branch information
mitucsaki committed Feb 28, 2018
1 parent 9890c66 commit 78854ff
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
34 changes: 34 additions & 0 deletions install-go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -e

GO="1.9.3"
echo "Checking for existing versions..."
if [ -d "$HOME/.go" ] || [ -d "$HOME/go" ]; then
echo "Go directories already exist."
exit 1
fi

echo "Downloading Go 1.9.3..."
wget https://dl.google.com/go/go$GO.linux-armv6l.tar$

if [ $? -ne 0 ]; then
echo "Download failed!"
exit 1
fi

echo "Creating Directories..."
tar -C "$HOME" -xzf $HOME/go.tar.gz
mv "$HOME/go" "$HOME/.go"
touch "$HOME/.bashrc"
{
echo '# GoLang'
echo 'export GOROOT=$HOME/.go'
echo 'export PATH=$PATH:$GOROOT/bin'
echo 'export GOPATH=$HOME/go'
echo 'export PATH=$PATH:$GOPATH/bin'
} >> "$HOME/.bashrc"

mkdir -p $HOME/go/{src,pkg,bin}
echo "Removing downloaded tar..."
rm -f $HOME/go.tar.gz
echo "Done! Run 'source ~/.bashrc' to complete!"
12 changes: 12 additions & 0 deletions uninstall-go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
echo "Removing files and directories..."
rm -rf $HOME/.go
rm -rf $HOME/go
sed -i '/# GoLang/d' "$HOME/.bashrc"
sed -i '/export GOROOT/d' "$HOME/.bashrc"
sed -i '/:$GOROOT/d' "$HOME/.bashrc"
sed -i '/export GOPATH/d' "$HOME/.bashrc"
sed -i '/:$GOPATH/d' "$HOME/.bashrc"
echo "Done! Run 'source ~/.bashrc' to complete."
exit 0

0 comments on commit 78854ff

Please sign in to comment.