dotfiles/common/configure_fresh_system.sh

224 lines
5.4 KiB
Bash
Raw Normal View History

#!/bin/bash
set -e
2018-10-15 13:29:14 +01:00
set -o pipefail
2016-07-30 20:39:07 +01:00
SUDO=""
if [[ -z $NOSUDO ]]; then
2016-07-30 20:42:34 +01:00
SUDO="sudo"
2016-07-30 20:39:07 +01:00
fi
2016-07-30 20:42:34 +01:00
echo "using '$SUDO' as sudo"
set -e
echo
echo "configuring settings common among OSes"
2016-07-30 20:39:07 +01:00
$SUDO true
2015-07-19 10:23:35 +01:00
#zsh
2015-07-19 10:23:35 +01:00
if [[ -z $DONT_CHANGE_SHELL ]]; then
echo "changing shell to zsh"
chsh -s `which zsh` $USER
2015-07-19 10:23:35 +01:00
fi
CURL="curl -sSfL"
2016-06-04 07:59:40 +01:00
if [[ -z $DIR ]]; then
echo "please set DIR"
exit 1
fi
DIR=`realpath $DIR`
echo "using $DIR as the top level directory"
cd $DIR
git submodule update --init --recursive
#configs
ln -vfs "$DIR/.vim" ~/.
2018-04-29 21:41:53 +01:00
ln -vfs "$DIR/.ideavimrc" ~/.
ln -vfs "$DIR/.vimrc.linux" ~/.vimrc
ln -vfs "$DIR/.tmux.conf" ~/.
2017-02-12 11:47:30 +00:00
ln -vfs "$DIR/.tmux.macosx" ~/.
rm -f "~/.zshrc"
2016-11-13 16:09:48 +00:00
ln -vfs "$DIR/.zprezto" ~/.
ln -vfs "$DIR/.zpreztorc" ~/.zpreztorc
2016-11-13 16:16:45 +00:00
ln -vfs "$DIR/.zprofile" ~/.zprofile
2016-11-13 16:09:48 +00:00
ln -vfs "$DIR/.zprezto/runcoms/zshenv" ~/.zshenv
ln -vfs "$DIR/.zshrc" ~/.zshrc
2017-01-26 05:44:03 +00:00
ln -vfs "$DIR/.hyper.js" ~/.hyper.js
ln -vfs "$DIR/.hyper_plugins" ~/.hyper_plugins
2016-11-13 16:09:48 +00:00
2017-01-19 10:03:34 +00:00
ln -vfs "$DIR/.setenv.sh" ~/.setenv
ln -vfs "$DIR/.Slic3r" ~/.
2015-02-28 21:39:29 +00:00
ln -vfs "$DIR/.ghci" ~/.
2016-05-03 19:20:46 +01:00
ln -vfs "$DIR/.conkyrc" ~/.
mkdir -p ~/.kde/share/config/
ln -vfs "$DIR/.kdiff3rc" ~/.kde/share/config/kdiff3rc
ln -vfs "$DIR/.gitconfig.linux.private" ~/.gitconfig
2015-04-12 18:07:50 +01:00
mkdir -p ~/.config/autostart/
2015-10-17 20:05:23 +01:00
# autostart apps
2015-07-04 11:12:53 +01:00
mkdir -p ~/.config/vdirsyncer/
ln -vfs "$DIR/.config/vdirsyncer/config" ~/.config/vdirsyncer/
mkdir -p ~/.config/Code/User
2016-11-25 19:05:15 +00:00
ln -vfs "$DIR/.config/Code/User/settings.json" ~/.config/Code/User/settings.json
ln -vfs "$DIR/.config/Code/User/keybindings.json" ~/.config/Code/User/keybindings.json
mkdir -p ~/.local/share/applications
2018-11-17 19:41:41 +00:00
cp -v "$DIR/keeweb.desktop" ~/.local/share/applications/
2018-09-14 08:03:03 +01:00
mkdir -p ~/.cargo/
2018-10-15 13:29:14 +01:00
echo "all links done"
2018-10-15 13:29:14 +01:00
echo "adding NVM"
2019-01-19 14:07:38 +00:00
$CURL -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
2018-10-15 13:29:14 +01:00
echo "sourcing env"
source ~/.setenv
2019-01-19 14:07:38 +00:00
nvm use node
# tools
ln -vfs "$DIR/tools" ~/
# stuff that does not like symbolic links
mkdir -vp ~/.config/terminator
rm -f ~/.config/terminator/config
ln "$DIR/.config/terminator/config" ~/.config/terminator/config
#install fonts
mkdir -p ~/.fonts
cp -rv "$DIR/fonts" ~/.fonts
set +e
fc-cache -rv
2016-07-30 20:39:07 +01:00
$SUDO fc-cache -rv
set -e
source "$DIR/common/install_vim_from_sources.sh"
2016-07-31 08:43:37 +01:00
if [[ -z $NORUST ]]; then
#rust
echo "installing rust"
RUSTUP_TEMP="/tmp/blastoff.sh"
$CURL https://sh.rustup.rs > "$RUSTUP_TEMP"
chmod a+x "$RUSTUP_TEMP"
"$RUSTUP_TEMP" -y
rm -f "$RUSTUP_TEMP"
rustup update
rustup install stable
rustup install nightly
2016-07-31 08:43:37 +01:00
rustup default stable
2018-06-03 12:03:17 +01:00
2018-05-27 23:56:28 +01:00
rustup component add rls-preview --toolchain stable
rustup component add clippy-preview --toolchain stable
2018-09-14 08:03:03 +01:00
rustup component add rustfmt-preview --toolchain stable
2018-05-27 23:56:28 +01:00
rustup component add rust-analysis --toolchain stable
rustup component add rust-src --toolchain stable
2018-05-27 23:56:28 +01:00
rustup component add rls-preview --toolchain nightly
2018-07-21 15:07:43 +01:00
rustup component add clippy-preview --toolchain nightly
2018-07-24 14:07:49 +01:00
rustup component add rustfmt-preview --toolchain nightly
rustup component add rust-analysis --toolchain nightly
2018-05-27 23:56:28 +01:00
rustup component add rust-src --toolchain nightly
2016-07-31 08:43:37 +01:00
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
2017-10-16 20:02:25 +01:00
set +e
2018-06-03 17:10:28 +01:00
cargo install cargo-update racer rustsym ripgrep fd-find genpass
cargo install-update -a
2018-06-09 11:18:45 +01:00
set -e
rustup run nightly cargo install-update -a
fi
2015-07-19 08:56:32 +01:00
2016-11-01 13:35:53 +00:00
set +e
echo "Querying for gpg2 path"
gpg2_path=`which gpg2`
echo "Got $gpg2_path for gpg2 path"
2016-11-01 13:38:20 +00:00
set -e
if [[ -x "$gpg2_path" ]]; then
2016-11-01 13:35:53 +00:00
echo "Using gpg2"
GPG=gpg2
else
echo "WARNING using gpg instead of gpg2"
GPG=gpg
fi
2016-08-11 13:37:03 +01:00
if [[ -z $NORUBY ]]; then
set +e
$GPG --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
set -e
2016-11-01 13:35:53 +00:00
$GPG --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
2016-11-03 20:12:59 +00:00
echo "Downloading RVM..."
$CURL https://get.rvm.io | bash
set +e
2016-11-03 20:12:59 +00:00
echo "Sourcing RVM..."
source /usr/local/rvm/scripts/rvm
source ~/.rvm/scripts/rvm
set -e
2016-11-03 20:12:59 +00:00
echo "Installing Ruby..."
rvm install ruby --disable-binary
2016-08-11 13:37:03 +01:00
fi
2016-08-05 08:56:31 +01:00
if [[ -z $NOVIM ]]; then
if [[ ! -d ~/.fzf ]]; then
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
else
cd ~/.fzf
git pull
git submodule update --init --recursive
fi
2017-05-14 13:05:54 +01:00
if [[ -z $NO_GO ]]; then
echo "Installing fzf"
~/.fzf/install --64 --all
fi
echo "Installing Vim plugins"
echo "\n" | vim +PlugClean! +qa
2018-05-27 23:07:20 +01:00
echo "\n" | vim +PlugInstall! +qa
2016-07-31 08:43:37 +01:00
fi
2016-08-04 16:59:32 +01:00
if [[ -z $NO_GO ]]; then
2017-03-18 09:16:20 +00:00
GOPATH="$HOME/go"
export GOPATH=`realpath "$GOPATH"`
2016-08-04 16:59:32 +01:00
mkdir -p "$GOPATH"
2016-04-10 18:38:38 +01:00
2016-08-04 16:59:32 +01:00
# excercism
go get -u github.com/exercism/cli/exercism
fi
2016-04-10 18:38:38 +01:00
2016-07-30 20:39:07 +01:00
$SUDO npm install -g reveal-md
$SUDO npm install -g diff-so-fancy
$SUDO npm install -g cssnano
2016-11-03 19:55:20 +00:00
if [[ -z $NOPYTHON3 ]]; then
2016-11-03 20:58:39 +00:00
set +e
2016-11-03 19:55:20 +00:00
pip3_path=`which pip3`
2016-11-03 20:58:39 +00:00
set -e
2016-11-03 19:55:20 +00:00
echo "pip3 path is $pip3_path"
2016-11-03 20:38:04 +00:00
if [[ -x "$pip3_path" ]]; then
2016-11-03 19:55:20 +00:00
echo "Choosing pip3 for pip"
PIP=pip3
else
echo "Choosing pip"
PIP=pip
fi
echo "Upgrading pip"
set +e
$SUDO $PIP install --upgrade pip setuptools
$SUDO $PIP install --upgrade packaging
set -e
2016-11-03 19:55:20 +00:00
echo "Installing Nikola"
2018-12-22 11:30:27 +00:00
$SUDO $PIP install --upgrade pygments-style-solarized ws4py watchdog webassets Nikola aiohttp
2018-05-27 23:51:05 +01:00
echo "Installing vim dependencies"
$SUDO $PIP install neovim
2016-10-16 16:35:28 +01:00
fi
2015-07-04 10:45:07 +01:00
if [[ -z $USER ]]; then
USER=`whoami`
fi
2015-07-04 10:45:07 +01:00
2015-08-18 17:47:25 +01:00
# normalize npm permissions
mkdir -p $HOME/.npm
2017-01-26 05:44:03 +00:00
$SUDO chown -R $USER $HOME/.npm
2015-08-18 17:47:25 +01:00
echo
echo "now go ahead and restart"
echo