Skip to content

Commit

Permalink
Various improvements
Browse files Browse the repository at this point in the history
- Install git-lfs using package manager instead of manually
- Control config install during setup via a flag
- If none of the platform variables are valid, exit with an error.
This is preferable to trying to continue and erroring unexpectantly.
- Don't fail the script if updatedb fails (usually due to permissions)
  • Loading branch information
GhostofGoes committed Nov 18, 2018
1 parent 077116a commit a029e16
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ useful_tools=(
'strace' # Useful for debugging
'dos2unix' # Convert /r/n (Windows) file endings to /n (Linux)
'tree'
'git' # Git version control system
'git' # The infamous version control system
'git-lfs' # Git Large File System (LFS)
'make'
'wget'
'curl'
Expand Down Expand Up @@ -198,7 +199,8 @@ INSTALL_PY3_PACKAGES=true
INSTALL_PY2_PACKAGES=false
INSTALL_VSCODE=true
INSTALL_DOCKER=true
INSTALL_GITLFS=true
IS_VM=true
INSTALL_CONFIGS=false

# Profile the OS
os_type
Expand Down Expand Up @@ -331,6 +333,8 @@ elif [ $FREEBSD ]; then
done
fi
sudo pkg autoremove
else
echo "ERROR: UNKNOWN PLATFORM" && exit 1
fi

echo "Configuring Timezone..."
Expand All @@ -351,7 +355,6 @@ if [ $WSL ] ; then
fi
fi


# Install Python packages
if [ "$INSTALL_PY3_PACKAGES" = true ] ; then
echo "Installing Python 3 packages..."
Expand All @@ -377,27 +380,14 @@ fi
# Install Docker
if [ "$INSTALL_DOCKER" = true ] && [ ! $WSL ] ; then
echo "Installing Docker..."
# This script will install any necessary dependencies for the platform
# On Debian, it will install it via Apt
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker "$USER"
rm -f "get-docker.sh"
fi

# Install git-lfs
# TODO: method to determine latest version
if [ "$INSTALL_GITLFS" = true ] ; then
LFSVERSION="2.4.2"
echo "Downloading git-lfs $LFSVERSION..."
wget https://github.com/git-lfs/git-lfs/releases/download/v"$LFSVERSION"/git-lfs-linux-amd64-"$LFSVERSION".tar.gz
echo "Installing git-lfs $LFSVERSION..."
tar -C ./ -xf git-lfs-linux-amd64-"$LFSVERSION".tar.gz
rm -f git-lfs-linux-amd64-"$LFSVERSION".tar.gz
pushd ./git-lfs-"$LFSVERSION" > /dev/null
sudo ./install.sh
popd > /dev/null
rm -rf "./git-lfs-$LFSVERSION/"
fi

# Install Visual Studio Code. Skip if we're in WSL.
if [ "$INSTALL_VSCODE" = true ] && [ ! $WSL ] && [ "$(command -v code > /dev/null)" -eq 1 ] ; then
install_vscode
Expand All @@ -418,8 +408,10 @@ fi

# Update the locate database
echo "Updating the 'locate' database..."
sudo updatedb
sudo updatedb || echo "Failed to update the 'locate' database"

# Install configs
echo "Installing custom configurations (.bashrc, .gitconfig, etc.) ..."
source ./configure.sh
if [ "$INSTALL_CONFIGS" = true ] ; then
echo "Installing custom configurations (.bashrc, .gitconfig, etc.) ..."
. ./configure.sh
fi

0 comments on commit a029e16

Please sign in to comment.