install: make it cleaner; don't install nvm

This commit is contained in:
2023-08-13 13:19:12 +01:00
parent fea969e641
commit b339bb9ea4

90
install
View File

@@ -5,12 +5,13 @@
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
MISSING=0
check_command() {
CMD=$1
FOUND=$(command -v $CMD)
if [ "$FOUND" == "" ] ; then
echo "You don't have $CMD."
exit 1
MISSING=1
else
echo "Found $FOUND."
fi
@@ -19,27 +20,22 @@ COMMANDS="git realpath curl"
for cmd in $COMMANDS ; do
check_command $cmd
done
install_rust_app() {
REPO=$1
DIRNAME=$2
BINARY=$3
if [ ! -d "$DIRNAME" ] ; then
git clone "$REPO" "$DIRNAME"
pushd "$DIRNAME" 1>/dev/null
else
pushd "$DIRNAME" 1>/dev/null
git pull
fi
cargo build --release
cp -fv $PWD/target/release/$BINARY ~/bin/
cargo clean
popd 1>/dev/null
}
if [ $MISSING -ne 0 ] ; then
exit $MISSING
fi
unset COMMANDS MISSING
BASE=$(pwd)
EXA_VER=
IS_MAC=0
IS_LINUX=0
if [ "$(uname -s)" == 'Darwin' ]; then
echo "Running on macOS"
IS_MAC=1
fi
if [ "$(uname -s)" == 'Linux' ]; then
echo "Running on Linux"
IS_LINUX=1
fi
# RC files
@@ -55,15 +51,6 @@ for rc in *rc *profile tmux.conf bashrc.d mutt ; do
fi
done
if [ "$(which cargo)" == "" ] ; then
# Install Cargo, in order to install exa etc.
(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh) || exit 1
source $HOME/.cargo/env
else
# Assume that if we have Cargo we have rustup too.
rustup update
fi
mkdir -p ~/src/
# git-prompt
@@ -81,7 +68,7 @@ for bin in $BASE/bin/*; do
fi
done
if [ "$(uname -s)" == 'Darwin' ]; then
if [ $IS_MAC ] ; then
# Homebrew
[ -z "$(which brew)" ] &&
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@@ -97,15 +84,19 @@ git config --global push.default current
if [ ! -d "$HOME/.rbenv" ] ; then
git clone https://github.com/rbenv/rbenv.git "$HOME/.rbenv"
git clone https://github.com/rbenv/ruby-build.git "$HOME/.rbenv/plugins/ruby-build"
else
echo "Already have $HOME/.rbenv"
fi
if [ ! -d "$HOME/.asdf" ] ; then
git clone https://github.com/asdf-vm/asdf.git "$HOME/.asdf"
else
echo "Already have $HOME/.asdf"
fi
# Add and install these ones.
ADD_AND_INSTALL="golang erlang elixir clojure ripgrep ag fd bat jq nodejs fzf"
if [ "$(uname -s)" == 'Darwin' ]; then
ADD_AND_INSTALL="golang ripgrep ag fd bat jq nodejs fzf github-cli"
if [ $IS_MAC ] ; then
echo "Detected macOS, installing extra packages via asdf."
ADD_AND_INSTALL="$ADD_AND_INSTALL git tmux vim"
fi
@@ -117,16 +108,20 @@ for plugin in $ADD_AND_INSTALL ; do
done
unset ADD_AND_INSTALL
asdf reshim
go install github.com/go-delve/delve/cmd/dlv@latest
# Just add these, for now.
ADD_ONLY="python tmux sbcl ocaml gohugo"
ADD_ONLY="python tmux sbcl ocaml gohugo erlang elixir clojure"
for plugin in $ADD_ONLY ; do
asdf plugin add $plugin
done
unset ADD_ONLY
# if [ "$(uname -s)" == 'Darwin' ]; then
# CPATH=$(brew --prefix)/include:$CPATH LIBRARY_PATH=$(brew --prefix)/lib:$LIBRARY_PATH asdf install sbcl latest
# fi
if [ $IS_MAC ] ; then
echo 'To install SBCL:'
echo 'CPATH=$(brew --prefix)/include:$CPATH LIBRARY_PATH=$(brew --prefix)/lib:$LIBRARY_PATH asdf install sbcl latest'
fi
if [ ! -d ~/.tmux/plugins/tpm ] ; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
@@ -134,20 +129,15 @@ if [ ! -d ~/.tmux/plugins/tpm ] ; then
# If we're currently in tmux, source the new file.
tmux source-file ~/.tmux.conf
fi
else
echo "Already have ~/.tmux/plugins/tpm"
fi
if [ ! -d "$HOME/.nvm" ] ; then
# Install nvm.
# (curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash) || exit 1
git clone https://github.com/nvm-sh/nvm.git ~/.nvm/
fi
source ./bashrc.d/nvm.bash
# We can't stop nvm appending to bashrc, but we don't need it - the variables nvm writes to .bashrc are already in
# ~/.bashrc.d/nvm.bash
cp bashrc bashrc-bk.nvm
nvm install node && nvm use node && corepack enable
cp bashrc-bk.nvm bashrc
# ./install-vim
if [ ! -d "$HOME/.emacs.d" ] ; then
echo "Attempting to clone ~/.emacs.d, but you may not be logged in to GitHub."
gh repo clone arafel/emacs.d ~/.emacs.d
else
echo "Already have $HOME/.emacs.d"
fi