diff --git a/build/run.sh b/build/run.sh index c3d5137..a88a464 100644 --- a/build/run.sh +++ b/build/run.sh @@ -36,6 +36,7 @@ pip3 install black echo chown -Rv $UID_TO_ADD:$GID_TO_ADD /home/user chown -Rv $UID_TO_ADD:$GID_TO_ADD /home/user +chsh --shell $(which zsh) $USERNAME_TO_ADD sudo \ --set-home \ diff --git a/build/user.sh b/build/user.sh index b824986..1d8d0ac 100644 --- a/build/user.sh +++ b/build/user.sh @@ -19,13 +19,21 @@ export ZSH="$HOME/.zsh" bash /tmp/installomz.sh --unattended --keep-zshrc # vim-plug -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +# this should happen from vimrc +#curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ +# https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim # link in ssh key from original home mkdir -p ~/.ssh ln -s ~/.home/.ssh/id_rsa ~/.ssh/id_rsa ln -s ~/.home/.ssh/id_rsa.pub ~/.ssh/id_rsa.pub +# install pyenv +git clone https://github.com/pyenv/pyenv.git ~/.pyenv +# FIXME install a python version + +git clone https://github.com/nvm-sh/nvm.git ~/.nvm +# FIXME install an nvm version + # move this to runtime FIXME #DEVDIR="$( cd ~/.home/dev >/dev/null 2>&1 && pwd -P)" diff --git a/root/etc/service/runtime-setup-user/run b/root/etc/service/runtime-setup-user/run index 31ddd05..03ce346 100644 --- a/root/etc/service/runtime-setup-user/run +++ b/root/etc/service/runtime-setup-user/run @@ -8,6 +8,14 @@ if [[ -e "$HD/.setupdone" ]]; then exit fi -sudo -l -u $UN /bin/bash << EOF - echo "user setup done" > ~/.setupdone -EOF +sudo \ + --set-home \ + --non-interactive \ + -u $UN \ + bash ./usersetup.sh && \ +sudo \ + --set-home \ + --non-interactive \ + -u $UN \ + touch $HD/.setupdone + diff --git a/root/etc/service/runtime-setup-user/usersetup.sh b/root/etc/service/runtime-setup-user/usersetup.sh new file mode 100644 index 0000000..42c3de1 --- /dev/null +++ b/root/etc/service/runtime-setup-user/usersetup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ -e ~/.home/Documents/scratch/dev ]]; then + ln -s ~/.home/Documents/scratch/dev ~/dev +else + ln -s ~/.home/dev ~/dev +fi diff --git a/root/home/user/.local/profile.d/100.aliases.sh b/root/home/user/.local/profile.d/100.aliases.sh new file mode 100644 index 0000000..b276bc9 --- /dev/null +++ b/root/home/user/.local/profile.d/100.aliases.sh @@ -0,0 +1,3 @@ +alias unsafessh="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" +alias prettier="prettier --tab-width 4" +alias gencapkey="ssh-keygen -m PEM -t rsa -b 2048 -C \"caprover\" -f ./key -q -N \"\"" diff --git a/root/home/user/.local/profile.d/100.editor.sh b/root/home/user/.local/profile.d/100.editor.sh new file mode 100644 index 0000000..1acad9c --- /dev/null +++ b/root/home/user/.local/profile.d/100.editor.sh @@ -0,0 +1,2 @@ +export EDITOR=vim + diff --git a/root/home/user/.local/profile.d/100.gopath.sh b/root/home/user/.local/profile.d/100.gopath.sh new file mode 100644 index 0000000..f24f559 --- /dev/null +++ b/root/home/user/.local/profile.d/100.gopath.sh @@ -0,0 +1,10 @@ + +export GOPATH="$HOME/dev/go" + +if [[ -d /usr/local/go/bin ]]; then + export PATH="$PATH:/usr/local/go/bin" +fi + +if [[ -d "$GOPATH/bin" ]]; then + export PATH="$PATH:$GOPATH/bin" +fi diff --git a/root/home/user/.local/profile.d/100.path.sh b/root/home/user/.local/profile.d/100.path.sh new file mode 100644 index 0000000..c1e1c71 --- /dev/null +++ b/root/home/user/.local/profile.d/100.path.sh @@ -0,0 +1,7 @@ +if [[ -d "$HOME/.local/bin" ]]; then + export PATH="$PATH:$HOME/.local/bin" +fi + +if [[ -d "$HOME/bin" ]]; then + export PATH="$PATH:$HOME/bin" +fi diff --git a/root/home/user/.local/profile.d/100.spyware.sh b/root/home/user/.local/profile.d/100.spyware.sh new file mode 100755 index 0000000..2a0c768 --- /dev/null +++ b/root/home/user/.local/profile.d/100.spyware.sh @@ -0,0 +1,10 @@ +export HOMEBREW_NO_ANALYTICS=1 +export GATSBY_TELEMETRY_DISABLED=1 +export STNOUPGRADE=1 +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export SAM_CLI_TELEMETRY=0 +export AZURE_CORE_COLLECT_TELEMETRY=0 +export DO_NOT_TRACK=1 +if command -v gcloud >/dev/null 2>&1 >/dev/null ; then + gcloud config set disable_usage_reporting true >/dev/null 2>&1 +fi diff --git a/root/home/user/.local/profile.d/200.gitconfig.sh b/root/home/user/.local/profile.d/200.gitconfig.sh new file mode 100644 index 0000000..c2d7692 --- /dev/null +++ b/root/home/user/.local/profile.d/200.gitconfig.sh @@ -0,0 +1 @@ +git config --global push.default matching diff --git a/root/home/user/.local/profile.d/200.pyenv.sh b/root/home/user/.local/profile.d/200.pyenv.sh new file mode 100644 index 0000000..99e56b2 --- /dev/null +++ b/root/home/user/.local/profile.d/200.pyenv.sh @@ -0,0 +1,6 @@ +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" + +if which pyenv 2>&1 > /dev/null ; then + eval "$(pyenv init -)" +fi diff --git a/root/home/user/.local/profile.d/300.nvm.sh b/root/home/user/.local/profile.d/300.nvm.sh new file mode 100644 index 0000000..6320b5c --- /dev/null +++ b/root/home/user/.local/profile.d/300.nvm.sh @@ -0,0 +1,5 @@ +export NVM_DIR="~/.nvm" + +if [[ -e "$NVM_DIR/nvm.sh" ]]; then + source "$NVM_DIR/nvm.sh" +fi diff --git a/root/home/user/.local/profile.d/999.bash-history.sh b/root/home/user/.local/profile.d/999.bash-history.sh new file mode 100644 index 0000000..de67ceb --- /dev/null +++ b/root/home/user/.local/profile.d/999.bash-history.sh @@ -0,0 +1,19 @@ +if [ -n "$BASH_VERSION" ]; then + +HISTSIZE=10000 +# Save 2,000,000 lines of history to disk (will have to grep ~/.bash_history for full listing) +HISTFILESIZE=2000000 +# Append to history instead of overwrite +shopt -s histappend +# Ignore redundant or space commands +HISTCONTROL=ignoreboth +# Ignore more +HISTIGNORE='ls:ll:ls -alh:pwd:clear:history' +# Set time format +HISTTIMEFORMAT='%F %T ' +# Multiple commands on one line show up as a single line +shopt -s cmdhist +# Append new history lines, clear the history list, re-read the history list, print prompt. +export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" + +fi diff --git a/root/home/user/.local/profile.d/999.kubectl.sh b/root/home/user/.local/profile.d/999.kubectl.sh new file mode 100644 index 0000000..b8b0893 --- /dev/null +++ b/root/home/user/.local/profile.d/999.kubectl.sh @@ -0,0 +1,8 @@ +if [ -n "$BASH_VERSION" ]; then + if which kubectl 2>&1 > /dev/null ; then + source <(kubectl completion bash) + fi + + alias k=kubectl + complete -F __start_kubectl k +fi diff --git a/root/home/user/.local/profile.d/999.zsh-git-prompt.sh b/root/home/user/.local/profile.d/999.zsh-git-prompt.sh new file mode 100644 index 0000000..feee7b5 --- /dev/null +++ b/root/home/user/.local/profile.d/999.zsh-git-prompt.sh @@ -0,0 +1,9 @@ +ZGP="$HOME/Library/Homebrew/opt/zsh-git-prompt/zshrc.sh" +if [ -n "$ZSH_VERSION" ]; then + if [[ -e "$ZGP" ]]; then + source "$ZGP" + fi + export PROMPT='%m:%~ $(git_super_status)$ ' +fi + + diff --git a/root/home/user/.zshrc b/root/home/user/.zshrc new file mode 100644 index 0000000..34be52a --- /dev/null +++ b/root/home/user/.zshrc @@ -0,0 +1,94 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="/home/user/.zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS=true + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in ~/.oh-my-zsh/plugins/* +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +export LANG=en_US.UTF-8 +export EDITOR=vim + +for FN in ~/.local/profile.d/*.sh ; do + source "$FN" +done + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh"