From 8bae155e0f67f3fcc61c0e60d5d00f210710dcc6 Mon Sep 17 00:00:00 2001 From: Felix Nehrke Date: Mon, 28 Feb 2022 23:39:37 +0100 Subject: [PATCH] Add setup-script for new machines --- .config/dotfiles/setup-machine.sh | 59 +++++++++++++++++++++++++++++++ README.adoc | 4 +++ 2 files changed, 63 insertions(+) create mode 100755 .config/dotfiles/setup-machine.sh diff --git a/.config/dotfiles/setup-machine.sh b/.config/dotfiles/setup-machine.sh new file mode 100755 index 0000000..0f4fc47 --- /dev/null +++ b/.config/dotfiles/setup-machine.sh @@ -0,0 +1,59 @@ +#!/bin/bash +set -e + +_osname=$(uname -s) + +if [ "$_osname" = "Darwin" ] +then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + brew install \ + git \ + wget \ + asciidoctor \ + bash-completion \ + vim +else + if [ $(which apt-get &>/dev/null) ] + then + sudo apt-get update + sudo apt-get install \ + git \ + wget \ + asciidoctor \ + bash-completion \ + vim + else + echo Unsupported system + exit 1 + fi +fi + +unset _osname + +# clone dotfiles for fast startup +GIT_DIR=$HOME/Development/nemoinho/gitea.nehrke.info/nemoinho/dotfiles +GIT_REMOTE=git@gitea.nehrke.info:nemoinho/dotfiles.git +git clone --separate-git-dir=$GIT_DIR $GIT_REMOTE $HOME/tmp-dotfiles +rm -r ~/tmp-dotfiles +alias config='/usr/bin/git --git-dir=$GIT_DIR --work-tree=$HOME' +config config --local status.showUntrackedFiles no +config checkout + +# reload bash_profile to configure the current shell with the just installed dotfiles +. ~/.bash_profile + +export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} + +# install java with sdkman +export SDKMAN_DIR=${SDKMAN_DIR:-$XDG_CONFIG_HOME/sdkman} +curl -s https://beta.sdkman.io | /bin/bash +source "$SDKMAN_DIR/bin/sdkman-init.sh" +sdk version +sdk install java 11.0.14-tem +sdk install gradle 7.4 + +# install nvm to manage nodejs +curl -s https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | /bin/bash +nvm install node + +echo "ready for work :-)" diff --git a/README.adoc b/README.adoc index 34d00c0..1be7342 100644 --- a/README.adoc +++ b/README.adoc @@ -19,6 +19,10 @@ config push == Setup +.Quick setup +[source,bash] +curl -s https://gitea.nehrke.info/nemoinho/dotfiles/raw/branch/main/.config/dotfiles/setup-machine.sh | bash + .Clone on new machine [source,bash] GIT_DIR=$HOME/Development/nemoinho/gitea.nehrke.info/nemoinho/dotfiles