install: make it cleaner; don't install nvm
This commit is contained in:
88
install
88
install
@@ -5,12 +5,13 @@
|
|||||||
|
|
||||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
||||||
|
|
||||||
|
MISSING=0
|
||||||
check_command() {
|
check_command() {
|
||||||
CMD=$1
|
CMD=$1
|
||||||
FOUND=$(command -v $CMD)
|
FOUND=$(command -v $CMD)
|
||||||
if [ "$FOUND" == "" ] ; then
|
if [ "$FOUND" == "" ] ; then
|
||||||
echo "You don't have $CMD."
|
echo "You don't have $CMD."
|
||||||
exit 1
|
MISSING=1
|
||||||
else
|
else
|
||||||
echo "Found $FOUND."
|
echo "Found $FOUND."
|
||||||
fi
|
fi
|
||||||
@@ -19,27 +20,22 @@ COMMANDS="git realpath curl"
|
|||||||
for cmd in $COMMANDS ; do
|
for cmd in $COMMANDS ; do
|
||||||
check_command $cmd
|
check_command $cmd
|
||||||
done
|
done
|
||||||
|
if [ $MISSING -ne 0 ] ; then
|
||||||
install_rust_app() {
|
exit $MISSING
|
||||||
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
|
fi
|
||||||
cargo build --release
|
unset COMMANDS MISSING
|
||||||
cp -fv $PWD/target/release/$BINARY ~/bin/
|
|
||||||
cargo clean
|
|
||||||
popd 1>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
BASE=$(pwd)
|
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
|
# RC files
|
||||||
|
|
||||||
@@ -55,15 +51,6 @@ for rc in *rc *profile tmux.conf bashrc.d mutt ; do
|
|||||||
fi
|
fi
|
||||||
done
|
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/
|
mkdir -p ~/src/
|
||||||
|
|
||||||
# git-prompt
|
# git-prompt
|
||||||
@@ -81,7 +68,7 @@ for bin in $BASE/bin/*; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$(uname -s)" == 'Darwin' ]; then
|
if [ $IS_MAC ] ; then
|
||||||
# Homebrew
|
# Homebrew
|
||||||
[ -z "$(which brew)" ] &&
|
[ -z "$(which brew)" ] &&
|
||||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
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
|
if [ ! -d "$HOME/.rbenv" ] ; then
|
||||||
git clone https://github.com/rbenv/rbenv.git "$HOME/.rbenv"
|
git clone https://github.com/rbenv/rbenv.git "$HOME/.rbenv"
|
||||||
git clone https://github.com/rbenv/ruby-build.git "$HOME/.rbenv/plugins/ruby-build"
|
git clone https://github.com/rbenv/ruby-build.git "$HOME/.rbenv/plugins/ruby-build"
|
||||||
|
else
|
||||||
|
echo "Already have $HOME/.rbenv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$HOME/.asdf" ] ; then
|
if [ ! -d "$HOME/.asdf" ] ; then
|
||||||
git clone https://github.com/asdf-vm/asdf.git "$HOME/.asdf"
|
git clone https://github.com/asdf-vm/asdf.git "$HOME/.asdf"
|
||||||
|
else
|
||||||
|
echo "Already have $HOME/.asdf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add and install these ones.
|
# Add and install these ones.
|
||||||
ADD_AND_INSTALL="golang erlang elixir clojure ripgrep ag fd bat jq nodejs fzf"
|
ADD_AND_INSTALL="golang ripgrep ag fd bat jq nodejs fzf github-cli"
|
||||||
if [ "$(uname -s)" == 'Darwin' ]; then
|
if [ $IS_MAC ] ; then
|
||||||
echo "Detected macOS, installing extra packages via asdf."
|
echo "Detected macOS, installing extra packages via asdf."
|
||||||
ADD_AND_INSTALL="$ADD_AND_INSTALL git tmux vim"
|
ADD_AND_INSTALL="$ADD_AND_INSTALL git tmux vim"
|
||||||
fi
|
fi
|
||||||
@@ -117,16 +108,20 @@ for plugin in $ADD_AND_INSTALL ; do
|
|||||||
done
|
done
|
||||||
unset ADD_AND_INSTALL
|
unset ADD_AND_INSTALL
|
||||||
|
|
||||||
|
asdf reshim
|
||||||
|
go install github.com/go-delve/delve/cmd/dlv@latest
|
||||||
|
|
||||||
# Just add these, for now.
|
# 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
|
for plugin in $ADD_ONLY ; do
|
||||||
asdf plugin add $plugin
|
asdf plugin add $plugin
|
||||||
done
|
done
|
||||||
unset ADD_ONLY
|
unset ADD_ONLY
|
||||||
|
|
||||||
# if [ "$(uname -s)" == 'Darwin' ]; then
|
if [ $IS_MAC ] ; then
|
||||||
# CPATH=$(brew --prefix)/include:$CPATH LIBRARY_PATH=$(brew --prefix)/lib:$LIBRARY_PATH asdf install sbcl latest
|
echo 'To install SBCL:'
|
||||||
# fi
|
echo 'CPATH=$(brew --prefix)/include:$CPATH LIBRARY_PATH=$(brew --prefix)/lib:$LIBRARY_PATH asdf install sbcl latest'
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d ~/.tmux/plugins/tpm ] ; then
|
if [ ! -d ~/.tmux/plugins/tpm ] ; then
|
||||||
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
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.
|
# If we're currently in tmux, source the new file.
|
||||||
tmux source-file ~/.tmux.conf
|
tmux source-file ~/.tmux.conf
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Already have ~/.tmux/plugins/tpm"
|
||||||
fi
|
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
|
# ./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
|
||||||
|
|||||||
Reference in New Issue
Block a user