|
#!/usr/bin/env bash |
|
|
|
if grep -q Microsoft /proc/version; then |
|
echo "Ubuntu on Windows (WSL)" |
|
WSL=1 |
|
else |
|
echo "native Linux" |
|
fi |
|
read -s -r -p "Enter Password for sudo: " sudoPW |
|
echo |
|
|
|
## git |
|
if ! [ -e ~/.ssh/id_rsa ]; then |
|
EMAIL="[email protected]" |
|
GIT_SSH="https://github.com/settings/ssh/new" |
|
ssh-keygen -t rsa -b 4096 -C "$EMAIL" -f ~/.ssh/id_rsa -q -N "" |
|
eval "$(ssh-agent -s)" |
|
ssh-add ~/.ssh/id_rsa |
|
|
|
if [ -n "$WSL" ]; then |
|
clip.exe < ~/.ssh/id_rsa.pub |
|
explorer.exe "$GIT_SSH" |
|
else |
|
echo "$sudoPW" | sudo -S apt-get install -y xclip |
|
xclip -sel clip < ~/.ssh/id_rsa.pub # or cat |
|
xdg-open "$GIT_SSH" |
|
fi |
|
|
|
git config --global user.name "Kessler dev" |
|
git config --global user.email "$EMAIL" |
|
fi |
|
|
|
## fish |
|
if ! hash fish 2>/dev/null; then |
|
echo "$sudoPW" | sudo -S apt-add-repository -y ppa:fish-shell/release-2 |
|
echo "$sudoPW" | sudo -S apt-get update |
|
echo "$sudoPW" | sudo -S apt-get install -y fish |
|
fi |
|
|
|
if ! [ -d ~/.local/share/omf ]; then |
|
bash -c "curl -L https://get.oh-my.fish | fish" |
|
fi |
|
|
|
if ! [ -d ~/.local/share/omf/themes/bobthefish ]; then |
|
fish -c "omf install bobthefish" |
|
fi |
|
|
|
FONT_URI="https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraMono/Regular/complete/Fura%20Mono%20Regular%20Nerd%20Font%20Complete%20Mono.otf?raw=true" |
|
if [ -n "$WSL" ]; then |
|
if ! [ -e /mnt/c/Fura-Mono-Regular.otf ]; then |
|
echo "$sudoPW" | curl -L "$FONT_URI" -o /mnt/c/Fura-Mono-Regular.otf |
|
explorer.exe "c:\Fura-Mono-Regular.otf" |
|
fi |
|
else |
|
if ! [ -e /usr/local/share/fonts/Fura-Mono-Regular.otf ]; then |
|
echo "$sudoPW" | sudo -S mkdir -p /usr/local/share/fonts |
|
echo "$sudoPW" | sudo -S curl -L "$FONT_URI" -o /usr/local/share/fonts/Fura-Mono-Regular.otf |
|
gsettings set org.gnome.desktop.interface monospace-font-name 'FuraMono Nerd Font Mono 11' |
|
fi |
|
fi |
|
|
|
if ! [ -d ~/.nvm ]; then |
|
bash -c "PROFILE=/dev/null curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash" |
|
sed -i -e 's/\. "\$NVM_DIR\/nvm\.sh"/\. "\$NVM_DIR\/nvm\.sh" "--no-use"/g' ~/.bashrc |
|
export NVM_DIR="$HOME/.nvm" |
|
# shellcheck source=/dev/null |
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" |
|
nvm install node |
|
NODE_PATH=$(dirname "$(command -v node)") |
|
echo "PATH=\"$NODE_PATH:\$PATH\"" >> ~/.profile |
|
|
|
npm install -g yarn |
|
|
|
### add yarn global to bashprofile |
|
cat <<EOT >> ~/.profile |
|
|
|
# set PATH so it includes yarn bin if it exists |
|
if [ -d "\$HOME/.yarn/bin" ] ; then |
|
PATH="\$HOME/.yarn/bin:\$PATH" |
|
fi |
|
EOT |
|
### global yarn |
|
|
|
yarn global add serverless |
|
|
|
fi |
|
## python |
|
|
|
if ! hash pip 2>/dev/null; then |
|
echo "$sudoPW" | sudo -S apt-get install -y python |
|
curl -O https://bootstrap.pypa.io/get-pip.py |
|
python get-pip.py --user |
|
rm get-pip.py |
|
fi |
|
|
|
if ! hash aws 2>/dev/null; then |
|
pip install awscli --upgrade --user |
|
mkdir -p ~/.aws |
|
|
|
cat <<EOT > ~/.aws/config |
|
[default] |
|
output = json |
|
region = eu-central-1 |
|
EOT |
|
AWS_CONSOLE="https://console.aws.amazon.com/" |
|
if [ -n "$WSL" ]; then |
|
explorer.exe "$AWS_CONSOLE" |
|
else |
|
xdg-open "$AWS_CONSOLE" |
|
fi |
|
fi |
|
|
|
if ! hash java 2>/dev/null; then |
|
## java |
|
echo "$sudoPW" | sudo -S apt-get install -y default-jre |
|
|
|
### add java to bashprofile |
|
cat <<EOT >> ~/.profile |
|
|
|
# set JAVA |
|
export JAVA_HOME="/usr/lib/jvm/default-java" |
|
|
|
export PATH=\$JAVA_HOME/bin:\$PATH |
|
EOT |
|
|
|
fi |