This commit is contained in:
Martin Donnelly 2020-02-10 10:48:34 +00:00
parent 8b507afcb4
commit 5913b7b848
3 changed files with 38 additions and 77 deletions

View File

@ -1,6 +1,7 @@
#!/bin/bash
NVM="$HOME/.nvm"
NVM_VERSION="stable"
NVM_VERSION="v0.35.2"
NODE_VERSION="--lts"
DEV="$HOME/dev"
LIVE="$HOME/live"
STAGING="$HOME/staging"
@ -11,6 +12,8 @@ pidof systemd && SYSTEMDCALL=1 || SYSTEMDCALL=0
UPDATE=no
DATABASE=no
NGINX=no
INSTALL=no
DONVM=no
RED=`tput setaf 1`
GREEN=`tput setaf 2`
@ -41,8 +44,10 @@ case $i in
NGINX=YES
shift # past argument=value
;;
-i|--install)
-i|--install|--setup)
UPDATE=YES
INSTALL=YES
DONVM=YES
# NGINX=YES
# DATABASE=YES
shift # past argument=value
@ -91,9 +96,26 @@ fancy_echo "${PURPLE}Updating system packages${RESET}"
else
echo $sudoPW | sudo -S apt-get -y -q --force-yes update
echo $sudoPW | sudo -S apt-get -y -q --force-yes upgrade
echo $sudoPW | sudo -S apt-get --assume-yes install build-essential git nginx htop screen wget curl default-jdk
echo $sudoPW | sudo -S apt-get -y -q --force-yes clean
fi
echo $sudoPW | sudo -S snap refresh
fi
if [[ $INSTALL = "YES" ]]; then
fancy_echo "${YELLOW}Installing Required ...${RESET}"
echo $sudoPW | sudo -S apt-get --assume-yes install build-essential git nginx htop screen wget curl default-jdk
echo $sudoPW | sudo -S apt-get -y -q --force-yes clean
echo $sudoPW | sudo -S snap install chromium
echo $sudoPW | sudo -S snap install webstorm --classic
echo $sudoPW | sudo -S snap install intellij-idea-ultimate --classic
echo $sudoPW | sudo -S snap install android-studio --classic
echo $sudoPW | sudo -S snap install qownnotes
fi
# set up and install swap file
@ -109,22 +131,22 @@ if [[ ! -f "$SWAP" ]]; then
fi
# setup node and npm
if [ ! -d "$NVM" ]; then
if [[ $DONVM = "YES" ]]; then
fancy_echo "${YELLOW}Installing Node...${RESET}"
# Will enter here if $DIRECTORY exists, even if it contains spaces
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/install.sh | bash
export NVM_DIR=$NVM
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
source $HOME/.bashrc
source $NVM/nvm.sh
nvm install $NVM_VERSION
nvm install $NODE_VERSION
fi
if [[ $UPDATE = "YES" ]]; then
if [[ $INSTALL = "YES" ]]; then
fancy_echo "${YELLOW}Installing Node Global Packages...${RESET}"
npm install -g gulp bower pm2@latest npm-check npm-install-missing
npm install -g gulp pm2@latest npm-check npm-install-missing
pm2 update
fi

View File

@ -1,69 +1,8 @@
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;
# If not running interactively: exit immediately.
# Note that 'return' works because the file is sourced, not executed.
if [[ $- != *i* ]] || [ -z "$PS1" ]; then
return 0
fi
# windows git bash version 3 is too minimal
bashVersionTmp="$(bash --version | grep -v "version 4")"
if [[ "$bashVersionTmp" == *-pc-msys* ]]; then
. ~/.extra
return 0
fi
unset bashVersionTmp
############# INCLUDE ####################################
# load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you dont want to commit.
for file in ~/.{config_dotfiles,path,load,colors,exports,icons,aliases,bash_complete,functions,extra,dotfilecheck}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
done
unset file
############# SETTINGS ###################################
# enable some Bash 4 features when possible:
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
# * Recursive globbing, e.g. `echo **/*.txt`
for option in autocd globstar cmdhist extglob cdable_vars; do
shopt -s "$option" 2> /dev/null
done
unset option
# When the command contains an invalid history operation (for instance when
# using an unescaped "!" (I get that a lot in quick e-mails and commit
# messages) or a failed substitution (e.g. "^foo^bar" when there was no "foo"
# in the previous command line), do not throw away the command line, but let me
# correct it.
shopt -s histreedit;
# append to the Bash history file, rather than overwriting it
shopt -s histappend
# rezize the windows-size if needed
shopt -s checkwinsize
# check if the user isn't root
if [ "$UID" != 0 ]; then
# case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob
# autocorrect typos in path names when using `cd`
shopt -s cdspell
fi
# Do not autocomplete when accidentally pressing Tab on an empty line. (It takes
# forever and yields "Display all 15 gazillion possibilites?")
shopt -s no_empty_cmd_completion;
# Do not overwrite files when redirecting using ">".
# Note that you can still override this with ">|".
#set -o noclobber;
############# EXTRA ####################################
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

View File

@ -1,7 +1,7 @@
[alias]
# Better update than just git pull
up = '!git remote update -p; git merge --ff-only @{u}'
up = !"git remote update -p; git merge --ff-only @{u}"
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit