From a43cc8ce5c19f8376099cdff7747e06b5e9d5f40 Mon Sep 17 00:00:00 2001 From: James Walker Date: Mon, 2 Nov 2020 20:07:39 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=20update=20scripts=20to=20work=20o?= =?UTF-8?q?n=20ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- home/.tmux.conf | 2 +- home/.zshenv | 9 ++++- home/.zshrc | 9 +++-- home/bin/goodmorning.sh | 27 +++++++++---- install.sh | 86 ++++++++++++++++++++++++++++------------- 5 files changed, 93 insertions(+), 40 deletions(-) diff --git a/home/.tmux.conf b/home/.tmux.conf index 8d1d023..e094599 100644 --- a/home/.tmux.conf +++ b/home/.tmux.conf @@ -13,4 +13,4 @@ set -g status-fg white bind-key X kill-session -set-option -g default-command "reattach-to-user-namespace -l zsh" +#set-option -g default-command "reattach-to-user-namespace -l zsh" diff --git a/home/.zshenv b/home/.zshenv index 181d7c9..7f82939 100644 --- a/home/.zshenv +++ b/home/.zshenv @@ -15,6 +15,11 @@ export CVS_RSH=ssh [ -f $HOME/.environment ] && . $HOME/.environment # Load asdf -. $(brew --prefix asdf)/asdf.sh +if [ type brew &> /dev/null ]; then + . $(brew --prefix asdf)/asdf.sh +else + . ~/.asdf/asdf.sh +fi + +[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ] && . $HOME/.nix-profile/etc/profile.d/nix.sh -[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ] && . $HOME/.nix-profile/etc/profile.d/nix.sh \ No newline at end of file diff --git a/home/.zshrc b/home/.zshrc index b1b4ae5..d429b7f 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -39,6 +39,7 @@ case "$OSTYPE" in ;; linux*) plugins=($plugins debian) + export PATH=/snap/bin:$PATH ;; esac @@ -52,9 +53,11 @@ if [ -d ~/Library/Android/sdk ]; then fi # zsh autosuggestions -zsh_autosuggestions=$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh -if [ -f $zsh_autosuggestions ]; then - source $zsh_autosuggestions +if [ type brew &> /dev/null ]; then + zsh_autosuggestions=$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh + if [ -f $zsh_autosuggestions ]; then + source $zsh_autosuggestions + fi fi if [ $TERM = "screen" ]; then diff --git a/home/bin/goodmorning.sh b/home/bin/goodmorning.sh index 7c98ddb..8ecb161 100755 --- a/home/bin/goodmorning.sh +++ b/home/bin/goodmorning.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash function install_latest() { version=$(asdf list-all $1 | grep -v '[a-z]' | tail -1) @@ -10,15 +10,26 @@ echo "* Updating homesick..." homesick pull homesick symlink -echo "* Restoring mackup..." -mackup restore +case "$OSTYPE" in + darwin*) + echo "* Restoring mackup..." + mackup restore + + echo "* Homebrew updates..." + brew bundle --global --no-lock + brew upgrade + + echo "* Upgrading mac app store apps..." + mas upgrade + ;; + linux*) + sudo apt update && sudo apt upgrade + sudo snap refresh + + ;; +esac -echo "* Homebrew updates..." -brew bundle --global --no-lock -brew upgrade -echo "* Upgrading mac app store apps..." -mas upgrade echo "* asdf update..." export R_CONFIGURE_OPTIONS="--with-x=no" diff --git a/install.sh b/install.sh index 9c3dbaf..6695cbe 100755 --- a/install.sh +++ b/install.sh @@ -1,33 +1,67 @@ #!/bin/bash -if [ ! -x "$(command -v git)" ]; then - echo "Installing xcode commandline tools..." - sudo xcode-select --install -fi +add_omz() { + if [ ! -d ~/.oh-my-zsh ]; then + echo "Installing oh-my-zsh..." + git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh + chsh -s /bin/zsh + else + echo "Oh-My-Zsh already installed." + fi +} -if [ ! -x "$(command -v brew)" ]; then - echo "Installing homebrew..." - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -else - echo "Homebrew already installed." -fi +add_homesick() { + if [ ! -d ~/.homesick ]; then + echo "Installing homesick..." + homesick clone https://github.com/walkah/dotfiles.git + homesick symlink + else + echo "Homesick already installed." + fi -if [ ! -d ~/.oh-my-zsh ]; then - echo "Installing oh-my-zsh..." - git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh - chsh -s /bin/zsh -else - echo "Oh-My-Zsh already installed." -fi +} + +install_macos() { + if [ ! -x "$(command -v git)" ]; then + echo "Installing xcode commandline tools..." + sudo xcode-select --install + fi + + if [ ! -x "$(command -v brew)" ]; then + echo "Installing homebrew..." + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + else + echo "Homebrew already installed." + fi + + add_omz -if [ ! -d ~/.homesick ]; then - echo "Installing homesick..." sudo gem install homesick - homesick clone https://github.com/walkah/dotfiles.git - homesick symlink -else - echo "Homesick already installed." -fi + add_homesick -echo "Initial brew bundle..." -brew bundle --global + echo "Initial brew bundle..." + brew bundle --global +} + +install_linux() { + sudo apt install zsh curl git homesick + sudo snap install starship + + add_omz + + add_homesick + + if [ ! -d ~/.asdf ]; then + git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0 + fi +} + +# Actual installer +case "$OSTYPE" in + darwin*) + install_macos + ;; + linux*) + install_linux + ;; +esac