├── .gitignore ├── README.md ├── data ├── dependencies.list ├── dsettings.list ├── gsettings.list ├── keys.list ├── packages-texlive.list ├── packages.list ├── repos.list └── rpackages.list ├── dot ├── .R │ └── Makevars ├── .Renviron ├── .Rprofile ├── .bashrc ├── .ccache │ └── ccache.conf ├── .dircolors ├── .gitconfig ├── .inputrc ├── .tmux.conf └── .vimrc ├── functions ├── aptadd ├── check ├── cleanup ├── configure ├── doall ├── non-apt │ ├── docker │ ├── instpandoc │ ├── instpython │ ├── instvim │ ├── latex-pkgs │ ├── rpackages │ ├── sourcecodepro │ └── travis ├── nonapt ├── packages └── variables └── setup.sh /.gitignore: -------------------------------------------------------------------------------- 1 | dot/.bash_aliases 2 | 3 | # vim files 4 | .*.un~ 5 | .*.swp 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ubuntu System Setup 2 | =========================== 3 | 4 | Adapted from 5 | [ubuntu-post-install scripts of Sam Hewitt](https://github.com/snwh/ubuntu-post-install), to whom all credit is due. 6 | 7 | ## Usage 8 | 9 | ``` 10 | ./setup.sh 11 | ``` 12 | or make an alias. 13 | 14 | ## Structure 15 | 16 | There are six main `functions` in the directory of that name, some of which use 17 | the `data` directory, and all of which use variables defined in 18 | `functions/variables`. 19 | 20 | 1. `doall` enables all functions to be run **non-interactively** to build an 21 | entirely new system from scratch (although it starts with `ubuntu-restricted-extras` 22 | which is the only bit that requires interaction to install mscorefonts) 23 | 24 | 2. `aptadd` adds `apt` keys (`/data/keys.list`) and repositories 25 | (`/data/repos.list`) 26 | 27 | 3. `apt` installs `packages.list` (and skips all those already installed) 28 | 29 | 4. `nonapt` opens a menu for the following additional functions 30 | 31 | i. `pandoc` to install the latest version from source 32 | 33 | ii. `python` to install a host of additional python modules 34 | 35 | iii.`vim` to install or upgrade `vim` from source, along with a host of extensions 36 | 37 | iv. `R packages` to install those 38 | 39 | v. `sourcecodepro` to install the font 40 | 41 | vi. `travis` to install the ruby gem for `travis-ci` 42 | 43 | 5. `configure` provides 3 configuration options, including installing dotfiles 44 | 45 | 6. `cleanup` removes obsolete packages, kernels, and the like 46 | 47 | 48 | In addition, `check` performs initial checks for packages necessary to run this 49 | script 50 | 51 | ------ 52 | 53 | 54 | ## Note 55 | 56 | The kinds of values given in `gsettings.list` and `dsettings.list` can be found by 57 | ``` 58 | > dconf watch / 59 | ``` 60 | Manually changing settings will then echo the corresponding `dconf` parameters. 61 | Some of these can not be `gset`. To find out which, just use 62 | ``` 63 | > gsettings get ... 64 | ``` 65 | with autocomplete to find out. Alternatively `gsettings list-recursively` will 66 | list all settings, or see the [compiz 67 | wiki](https://wiki.archlinux.org/index.php/Compiz_configuration) 68 | 69 | ------ 70 | 71 | ## Manual tasks 72 | 73 | Some tasks can nevertheless only be completed manually ... 74 | 75 | ### 1. Terminal font 76 | 77 | ``` 78 | profile -> general -> font -> SourceCodePro Light 9pt 79 | ``` 80 | 81 | ### 2. [Vundle.vim](https://github.com/VundleVim/Vundle.vim) 82 | 83 | Often does seem to work on first install. If `unknown function vundle#begin` is 84 | flagged, simply repeat setup: 85 | ``` 86 | rm -rf .vim/bundle/Vundle.vim 87 | git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 88 | ``` 89 | 90 | ### 3. gnome soliarized 91 | 92 | Clone repo as described [here](https://github.com/gmodarelli/solarize), then 93 | simply 94 | ``` 95 | cd ~/.solarized/gnome 96 | ./install.sh 97 | ``` 98 | to configure both light and dark profiles 99 | 100 | ### 4. Nvim-r 101 | 102 | [`.Rprofile` has two lines](https://github.com/mpadge/ubuntu-setup/blob/master/dot/.Rprofile#L8-L11) 103 | that need to be changed around in order to properly install 104 | [`Nvim-r`](https://github.com/jalvesaq/Nvim-R) the first time (using 105 | [`vundle`](https://github.com/VundleVim/Vundle.vim), so install with 106 | `:PluginInstall`). After that, they need to be changed back the way they were. 107 | 108 | ### 5. Computer name 109 | 110 | If not set at install, just change both: 111 | ``` 112 | /etc/hosts 113 | /etc/hostname 114 | ``` 115 | 116 | 117 | 162 | -------------------------------------------------------------------------------- /data/dependencies.list: -------------------------------------------------------------------------------- 1 | software-properties-common 2 | whiptail 3 | xterm 4 | -------------------------------------------------------------------------------- /data/dsettings.list: -------------------------------------------------------------------------------- 1 | /org/compiz/profiles/unity/plugins/unityshell/icon-size 32 2 | /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode 1 3 | -------------------------------------------------------------------------------- /data/gsettings.list: -------------------------------------------------------------------------------- 1 | org.gnome.desktop.wm.preferences titlebar-font 'Ubuntu 10' 2 | org.gnome.desktop.interface font-name 'Ubuntu 10' 3 | org.gnome.desktop.interface document-font-name 'Sans 11' 4 | org.gnome.desktop.interface monospace-font-name 'Source Code Pro Light 9' 5 | org.gnome.shell.app-switcher current-workspace-only true 6 | org.gnome.settings-daemon.plugins.power lid-close-ac-action 'shutdown' 7 | org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend' 8 | org.gnome.settings-daemon.plugins.media-keys email 'm' 9 | org.gnome.desktop.session idle-delay 600 10 | org.gnome.desktop.screensaver lock-enabled false 11 | org.gnome.desktop.screensaver ubuntu-lock-on-suspend false 12 | org.gnome.desktop.background picture-options 'zoom' 13 | org.gnome.desktop.privacy remember-recent-files false 14 | org.gnome.nautilus.preferences default-folder-viewer 'list-view' 15 | org.gnome.nautilus.list-view default-zoom-level 'smallest' 16 | org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 2 17 | org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize 2 18 | org.compiz.core:/org/compiz/profiles/unity/plugins/core/ active-plugins "['core','composite','opengl','commands','imgpng','mousepoll','copytex', 'compiztoolbox', 'grid', 'resize', 'move', 'put', 'regex', 'place', 'wall', 'snap', 'vpswitch', 'unitymtgrabhandles', 'session', 'animation', 'fade', 'workarounds', 'expo', 'scale', 'ezoom', 'unityshell']" 19 | org.compiz.put:/org/compiz/profiles/unity/plugins/put/ put-next-output-key 'n' 20 | -------------------------------------------------------------------------------- /data/keys.list: -------------------------------------------------------------------------------- 1 | E084DAB9 2 | -------------------------------------------------------------------------------- /data/packages-texlive.list: -------------------------------------------------------------------------------- 1 | #texlive-full 2 | chktex 3 | context 4 | dvidvi 5 | dvipng 6 | fragmaster 7 | lacheck 8 | latexmk 9 | lcdf-typetools 10 | lmodern 11 | psutils 12 | purifyeps 13 | t1utils 14 | tex-gyre 15 | tex4ht 16 | texinfo 17 | texlive-base 18 | texlive-bibtex-extra 19 | texlive-binaries 20 | texlive-extra-utils 21 | texlive-font-utils 22 | texlive-fonts-extra 23 | texlive-fonts-recommended 24 | texlive-formats-extra 25 | texlive-generic-extra 26 | texlive-generic-recommended 27 | texlive-htmlxml 28 | texlive-humanities 29 | texlive-lang-english 30 | texlive-lang-german 31 | texlive-latex-base 32 | texlive-latex-base-doc 33 | texlive-latex-extra 34 | texlive-latex-extra-doc 35 | texlive-latex-recommended 36 | texlive-latex-recommended-doc 37 | texlive-math-extra 38 | texlive-metapost 39 | texlive-pictures 40 | texlive-pictures-doc 41 | texlive-plain-extra 42 | texlive-pstricks 43 | texlive-pstricks-doc 44 | texlive-publishers 45 | texlive-publishers-doc 46 | texlive-science 47 | texlive-science-doc 48 | texlive-xetex 49 | -------------------------------------------------------------------------------- /data/packages.list: -------------------------------------------------------------------------------- 1 | ubuntu-restricted-extras 2 | curl 3 | autojump # https://github.com/wting/autojump 4 | autotools-dev # packages.list can include comments 5 | checkinstall 6 | clang-3.9 # clang - see apt.llvm.org 7 | cmake 8 | compizconfig-settings-manager 9 | compiz-plugins-extra 10 | dos2unix 11 | expat # For GDAL OSM Driver 12 | exuberant-ctags 13 | git 14 | gnome-tweak-tool 15 | gparted 16 | gsl-bin 17 | htop 18 | imagemagick 19 | jabref 20 | kcachegrind 21 | libatk1.0-dev # for vim: see instvim 22 | libbonoboui2-dev # for vim: see instvim 23 | libboost-all-dev 24 | libcairo2-dev # for vim: see instvim 25 | libcgal-dev 26 | libclang-3.9-dev # clang - see apt.llvm.org 27 | libclang-common-3.9-dev # clang - see apt.llvm.org 28 | libcurl4-openssl-dev 29 | libncurses5-dev # for vim: see instvim 30 | libeigen3-dev 31 | libgeos-dev 32 | libglu1-mesa-dev 33 | libgeos++-dev 34 | libgmp3-dev 35 | libgnome2-dev # for vim: see instvim 36 | libgnomeui-dev # for vim: see instvim 37 | libgsl-dev 38 | libgtk2.0-dev # for vim: see instvim 39 | libllvm3.9 # clang - see apt.llvm.org 40 | libperl-dev # for vim: see instvim 41 | libpq-dev # for RPostgreSQL 42 | libproj-dev 43 | libprotobuf-dev 44 | libprotoc-dev 45 | libspatialite-dev 46 | libspatialite3 47 | libsqlite3-dev 48 | libsqlite3-0 49 | libssl-dev 50 | libudunits2-dev # for R units via sp 51 | libv8-3.14-dev # for R tmap 52 | libx11-dev 53 | libxml2-dev 54 | libxpm-dev # for vim: see instvim 55 | libxt-dev # for vim: see instvim 56 | libzip-dev 57 | lldb-3.9 # clang - see apt.llvm.org 58 | llvm-3.9 # clang - see apt.llvm.org 59 | llvm-3.9-dev # clang - see apt.llvm.org 60 | lua5.1 61 | liblua5.1-0-dev # lua5.1-dev for vim 62 | lxd 63 | mesa-common-dev 64 | mc 65 | nautilus-dropbox 66 | neovim 67 | openjdk-8-jre 68 | openjdk-8-jdk 69 | osmctools 70 | pdftk 71 | postgis 72 | postgresql 73 | postgresql-contrib 74 | protobuf-compiler 75 | python3-dev 76 | python3-pip 77 | python-bs4 78 | python-dev 79 | python-regex 80 | r-base 81 | r-base-dev 82 | r-cran-rjava 83 | rsync 84 | ruby-dev 85 | skype 86 | ssh 87 | sqlite3 88 | #texlive-full 89 | tmux 90 | tree 91 | valgrind 92 | vim-latexsuite 93 | vlc 94 | zathura # for Nvim-r 95 | zfsutils-linux 96 | -------------------------------------------------------------------------------- /data/repos.list: -------------------------------------------------------------------------------- 1 | deb http://cran.r-project.org/bin/linux/ubuntu xenial/ 2 | ppa:git-core/ppa 3 | deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main 4 | deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main 5 | deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main 6 | deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main 7 | ppa:neovim-ppa/stable 8 | -------------------------------------------------------------------------------- /data/rpackages.list: -------------------------------------------------------------------------------- 1 | adehabitatLT # packages can contain comments 2 | animation 3 | bitops 4 | CircStats 5 | changepoint 6 | chron 7 | codetools 8 | combinat 9 | cubature 10 | data.table 11 | dbscan 12 | devtools 13 | distr 14 | dplyr 15 | dbplyr 16 | extrafont 17 | fAsianOptions 18 | fields 19 | fpc 20 | ggm 21 | ggmap 22 | ggplot2 23 | gridBase 24 | hexbin 25 | httr 26 | hunspel 27 | igraph 28 | knitr 29 | leaflet 30 | lubridate 31 | maptools 32 | microbenchmark 33 | msm 34 | nabor # stplanr dep 35 | OpenStreetMap 36 | openxlsx 37 | osmar 38 | plyr 39 | poweRlaw 40 | pracma 41 | quantreg 42 | R.utils # stplanr dep 43 | R2Cuba 44 | RANN 45 | raster 46 | Rcpp 47 | RcppArmadillo # stplanr dep 48 | RCurl 49 | readr # stplanr dep 50 | readxl 51 | rgdal 52 | rgeos 53 | rgl 54 | RgoogleMaps # stplanr dep 55 | rJava 56 | rjson 57 | rmarkdown 58 | roxygen2 59 | RPostgreSQL 60 | RSQLite 61 | rvest 62 | sf 63 | signal 64 | sp 65 | spacetime 66 | spatialkernel 67 | spatstat 68 | spdep 69 | testthat 70 | tmap 71 | tripack 72 | units # sf dep 73 | VGAM 74 | XML 75 | xml2 76 | yaml 77 | -------------------------------------------------------------------------------- /dot/.R/Makevars: -------------------------------------------------------------------------------- 1 | VER= 2 | CCACHE=ccache 3 | CCACHE= 4 | COMPXX=clang++ 5 | COMP=clang 6 | #CXX=g++ 7 | #C=g++ 8 | 9 | EXCL_A=/usr/local/lib/R/site-library/Rcpp/include 10 | EXCL_B=/usr/local/lib/R/site-library/RcppArmadillo/include 11 | EXCL_C=/usr/local/lib/R/site-library/RcppParallel/include 12 | 13 | CXX=$(CCACHE) $(COMPXX)$(VER) 14 | CXXFLAGS= -Wall -pedantic -Wconversion -isystem $(EXCL_A) -isystem $(EXCL_B) -isystem $(EXCL_C) 15 | #CXXFLAGS= -Wall -pedantic 16 | 17 | CXX11=$(CCACHE) $(COMPXX)$(VER) 18 | CXX11FLAGS= -Wall -pedantic -Wconversion -isystem $(EXCL_A) -isystem $(EXCL_B) -isystem $(EXCL_C) 19 | #CXX11FLAGS= -Wall -pedantic 20 | 21 | CXX14=$(CCACHE) $(COMPXX)$(VER) 22 | CXX14FLAGS= -Wall -pedantic -Wconversion -isystem $(EXCL_A) -isystem $(EXCL_B) -isystem $(EXCL_C) 23 | #CXX14FLAGS= -Wall -pedantic 24 | 25 | CC=$(CCACHE) $(COMP)$(VER) 26 | 27 | FC=$(CCACHE) gfortran$(VER) 28 | F77=$(CCACHE) gfortran$(VER) 29 | -------------------------------------------------------------------------------- /dot/.Renviron: -------------------------------------------------------------------------------- 1 | MPADGE_LOCAL=true 2 | -------------------------------------------------------------------------------- /dot/.Rprofile: -------------------------------------------------------------------------------- 1 | local ({ 2 | r <- getOption('repos') 3 | #r['CRAN'] <- 'https://cran.uni-muenster.de' 4 | r['CRAN'] <- 'https://cran.wu.ac.at' 5 | options(repos=r) 6 | }) 7 | # http://stackoverflow.com/questions/24387660/how-to-change-libpaths-permanently-in-r 8 | # Note that the order of these has to be reversed for initial installation of 9 | # nvimcom, then they can be reset. 10 | .libPaths(c ('~/R/x86_64-pc-linux-gnu-library/3.4', .libPaths ())) 11 | .libPaths(c ('/usr/local/lib/R/site-library', .libPaths ())) 12 | 13 | #options (stringsAsFactors=FALSE) 14 | #options (max.print=100) 15 | options (width = 80) 16 | options (scipen=10) 17 | options (editor='vim') 18 | #options (prompt='R> ', digits=4) 19 | 20 | .env <- new.env() 21 | .env$setpar <- function (mar=c(3, 3, 2, 1), mgp=c(1.7, 0.3, 0)) 22 | { 23 | par (mar=mar, mgp=mgp) 24 | } 25 | attach(.env) 26 | 27 | .First <- function(){ 28 | if(interactive()){ 29 | # see :h nvimcom-not-loaded 30 | #if (Sys.getenv ("NVIMR_TMPDIR") == "") 31 | # options (defaultPackages = c ("utils", "grDevices", "graphics", 32 | # "stats", "methods")) 33 | #else 34 | # options (defaultPackages = c ("utils", "grDevices", "graphics", 35 | # "stats", "methods", "nvimcom")) 36 | 37 | if ('colorout' %in% rownames (utils::installed.packages ())) 38 | { 39 | library (colorout) 40 | # default normal green too faint for light bg 41 | setOutputColors (normal = 0, verbose = FALSE) 42 | } 43 | 44 | rv <- R.Version ()$version.string 45 | rn <- R.Version ()$nickname 46 | rpl <- R.Version ()$platform 47 | rsys <- Sys.info () 48 | ss <- system ('. /etc/os-release; echo ${VERSION}', intern=T) 49 | 50 | lns <- list () 51 | lns [[1]] <- paste0 (rv, '--- \'', rn, '\'') 52 | lns [[2]] <- paste0 ('Ubuntu ', ss, ' (kernel ', rsys ['release'], ')') 53 | lns [[3]] <- paste0 ('machine = ', rpl, ': ', rsys ['nodename']) 54 | lns [[4]] <- paste0 ('wd: ', getwd ()) 55 | lns <- sapply (lns, function (i) 56 | { 57 | if ((nchar (i) %% 2) != 0) 58 | i <- paste0 (i, ' ') 59 | return (i) 60 | }) 61 | nc <- max (sapply (lns, nchar)) 62 | gap <- 2 # number of character before and after 63 | nci <- sapply (lns, nchar, USE.NAMES=FALSE) 64 | gaplen <- floor (nc + 2 * gap - nci) / 2 65 | 66 | #for (i in 2500:2600) 67 | # cat(eval(parse(text=paste("\"\\u", i, "\"", sep=""))), " ") 68 | top <- "\u2583" 69 | bot <- "\u2580" 70 | vc <- "\u2588" 71 | 72 | bl <- ' ' # blanks at left side 73 | top_half <- paste0 (rep (top, gap + nc / 2 - 1)) 74 | message (bl, top_half, ' R ', top_half, top) 75 | message (paste0 (bl, vc, paste0 (rep (' ', gap + nc + 1), collapse=''), ' ', vc)) 76 | for (i in 1:length (lns)) 77 | { 78 | gaps <- paste0 (rep (' ', gaplen [i]), collapse='') 79 | message (paste0 (bl, vc, gaps, lns [[i]], gaps, vc)) 80 | } 81 | message (paste0 (bl, vc, paste0 (rep (' ', gap + nc + 1), collapse=''), ' ', vc)) 82 | bot_half <- paste0 (rep (bot, gap + nc / 2 - 1)) 83 | message (bl, bot_half, ' R ', bot_half, bot) 84 | message ('') 85 | 86 | if (curl::has_internet ()) 87 | { 88 | # only check for new packages once per day 89 | chk_file <- "~/.Rold_pkg_check" 90 | do_check <- TRUE 91 | today <- strsplit (as.character (Sys.time ()), " ") [[1]] [1] 92 | if (file.exists (chk_file)) 93 | { 94 | chk_date <- utils::read.table (chk_file, as.is=TRUE) [1, 1] 95 | if (chk_date == today) 96 | do_check = FALSE 97 | } 98 | write (today, file = chk_file) 99 | if (do_check) 100 | { 101 | message ('Old package check for ', today, ' : ', appendLF=FALSE) 102 | old <- utils::old.packages () 103 | if (!is.null (old)) 104 | message ('Updatable packages: ', 105 | do.call (paste, as.list (rownames (old))), '\n') 106 | else 107 | message ('All packages up to date\n') 108 | } 109 | } else 110 | message ('nope, no internet\n') 111 | } 112 | } 113 | 114 | 115 | #if(Sys.getenv('TERM') == 'xterm-256color') 116 | # library('colorout') 117 | -------------------------------------------------------------------------------- /dot/.bashrc: -------------------------------------------------------------------------------- 1 | # ~.bashrc: executed by bash(1) for non-login shells. 2 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 3 | # for examples 4 | 5 | # If not running interactively, don't do anything 6 | case $- in 7 | *i*) ;; 8 | *) return;; 9 | esac 10 | 11 | # don't put duplicate lines or lines starting with space in the history. 12 | # See bash(1) for more options 13 | HISTCONTROL=ignoreboth 14 | 15 | # append to the history file, don't overwrite it 16 | shopt -s histappend 17 | 18 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 19 | HISTSIZE=10000 20 | HISTFILESIZE=10000 21 | 22 | # Then extra stuff to append history from all tmux windows: 23 | export HISTCONTROL=ignoredups:erasedups # no duplicate entries 24 | shopt -s histappend # append to history, don't overwrite it 25 | # Save and reload the history after each command finishes 26 | export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" 27 | 28 | # https://github.com/wting/autojump 29 | [[ -s $HOME/.autojump/etc/profile.d/autojump.sh ]] && source $HOME/.autojump/etc/profile.d/autojump.sh 30 | 31 | # check the window size after each command and, if necessary, 32 | # update the values of LINES and COLUMNS. 33 | shopt -s checkwinsize 34 | 35 | # If set, the pattern "**" used in a pathname expansion context will 36 | # match all files and zero or more directories and subdirectories. 37 | #shopt -s globstar 38 | 39 | # make less more friendly for non-text input files, see lesspipe(1) 40 | [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 41 | 42 | # set variable identifying the chroot you work in (used in the prompt below) 43 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 44 | debian_chroot=$(cat /etc/debian_chroot) 45 | fi 46 | 47 | # set a fancy prompt (non-color, unless we know we "want" color) 48 | case "$TERM" in 49 | xterm-color) color_prompt=yes;; 50 | esac 51 | 52 | # uncomment for a colored prompt, if the terminal has the capability; turned 53 | # off by default to not distract the user: the focus in a terminal window 54 | # should be on the output of commands, not on the prompt 55 | #force_color_prompt=yes 56 | 57 | if [ -n "$force_color_prompt" ]; then 58 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 59 | # We have color support; assume it's compliant with Ecma-48 60 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 61 | # a case would tend to support setf rather than setaf.) 62 | color_prompt=yes 63 | else 64 | color_prompt= 65 | fi 66 | fi 67 | 68 | if [ "$color_prompt" = yes ]; then 69 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 70 | else 71 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 72 | fi 73 | unset color_prompt force_color_prompt 74 | 75 | # If this is an xterm set the title to user@host:dir 76 | case "$TERM" in 77 | xterm*|rxvt*) 78 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 79 | ;; 80 | *) 81 | ;; 82 | esac 83 | 84 | # enable color support of ls and also add handy aliases 85 | if [ -x /usr/bin/dircolors ]; then 86 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 87 | alias ls='ls --color=auto' 88 | #alias dir='dir --color=auto' 89 | #alias vdir='vdir --color=auto' 90 | 91 | alias grep='grep --color=auto' 92 | alias fgrep='fgrep --color=auto' 93 | alias egrep='egrep --color=auto' 94 | fi 95 | 96 | # some more ls aliases 97 | alias ll='ls -alF' 98 | alias la='ls -A' 99 | alias l='ls -CF' 100 | 101 | # Add an "alert" alias for long running commands. Use like so: 102 | # sleep 10; alert 103 | alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' 104 | 105 | # Alias definitions. 106 | # You may want to put all your additions into a separate file like 107 | # ~/.bash_aliases, instead of adding them here directly. 108 | # See /usr/share/doc/bash-doc/examples in the bash-doc package. 109 | 110 | if [ -f ~/.bash_aliases ]; then 111 | . ~/.bash_aliases 112 | fi 113 | 114 | # enable programmable completion features (you don't need to enable 115 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 116 | # sources /etc/bash.bashrc). 117 | if ! shopt -oq posix; then 118 | if [ -f /usr/share/bash-completion/bash_completion ]; then 119 | . /usr/share/bash-completion/bash_completion 120 | elif [ -f /etc/bash_completion ]; then 121 | . /etc/bash_completion 122 | fi 123 | fi 124 | 125 | # Essential line to get tmux to work with solarized: 126 | export TERM=screen-256color-bce 127 | 128 | # Add custom colour scheme produced from http://ciembor.github.io/4bit/# 129 | # source ../solarized.sh 130 | 131 | # Nvim-r-plugin requires its own line in .vimrc to achieve this 132 | alias R='R --no-save --no-restore --quiet' 133 | alias sudo='sudo ' # ensures that sudo R loads .Rprofile 134 | 135 | # shell promopt (31m = red, 32m = green) 136 | export PS1='\[\e[1;32m\]\w\$\[\e[0m\] ' 137 | 138 | # read ~/.dircolors: 139 | d=.dircolors 140 | test -r $d && eval "$(dircolors $d)" 141 | 142 | # added by travis gem 143 | [ -f ~/.travis/travis.sh ] && source ~/.travis/travis.sh 144 | 145 | # from @karpfen: 146 | function run { 147 | if [ -z "$1" ]; then 148 | echo "Usage: run " 149 | else 150 | if [ -f $1 ] ; then 151 | xdg-open $1 &> /dev/null 152 | else 153 | echo "$1 - file does not exist" 154 | fi 155 | fi 156 | } 157 | 158 | function extract { 159 | if [ -z "$1" ]; then 160 | # display usage if no parameters given 161 | echo "Usage: extract ." 162 | else 163 | if [ -f $1 ] ; then 164 | # NAME=${1%.*} 165 | # mkdir $NAME && cd $NAME 166 | case $1 in 167 | *.tar.bz2) tar xvjf ./$1 ;; 168 | *.tar.gz) tar xvzf ./$1 ;; 169 | *.tar.xz) tar xvJf ./$1 ;; 170 | *.lzma) unlzma ./$1 ;; 171 | *.bz2) bunzip2 ./$1 ;; 172 | *.rar) unrar x -ad ./$1 ;; 173 | *.gz) gunzip ./$1 ;; 174 | *.tar) tar xvf ./$1 ;; 175 | *.tbz2) tar xvjf ./$1 ;; 176 | *.tgz) tar xvzf ./$1 ;; 177 | *.zip) unzip ./$1 ;; 178 | *.Z) uncompress ./$1 ;; 179 | *.7z) 7z x ./$1 ;; 180 | *.xz) unxz ./$1 ;; 181 | *.exe) cabextract ./$1 ;; 182 | *) echo "extract: '$1' - unknown archive method" ;; 183 | esac 184 | else 185 | echo "$1 - file does not exist" 186 | fi 187 | fi 188 | } 189 | 190 | function title () { 191 | echo -ne "\033]0;${1}\007" 192 | } 193 | -------------------------------------------------------------------------------- /dot/.ccache/ccache.conf: -------------------------------------------------------------------------------- 1 | # http://dirk.eddelbuettel.com/blog/2017/11/27/#011_faster_package_installation_one 2 | size = 5.0G 3 | # important for R CMD INSTALL *.tar.gz as tarballs are expanded freshly -> fresh ctime 4 | sloppiness = include_file_ctime 5 | # also important as the (temp.) directory name will differ 6 | hash_dir = false 7 | -------------------------------------------------------------------------------- /dot/.dircolors: -------------------------------------------------------------------------------- 1 | # Genated with 2 | # dircolors -p > ~/.dircolors 3 | # https://askubuntu.com/questions/466198/how-do-i-change-the-color-for-directories-with-ls-in-the-console 4 | 5 | # Configuration file for dircolors, a utility to help you set the 6 | # LS_COLORS environment variable used by GNU ls with the --color option. 7 | # Copyright (C) 1996-2016 Free Software Foundation, Inc. 8 | # Copying and distribution of this file, with or without modification, 9 | # are permitted provided the copyright notice and this notice are preserved. 10 | # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the 11 | # slackware version of dircolors) are recognized but ignored. 12 | # Below are TERM entries, which can be a glob patterns, to match 13 | # against the TERM environment variable to determine if it is colorizable. 14 | TERM Eterm 15 | TERM ansi 16 | TERM color-xterm 17 | TERM con[0-9]*x[0-9]* 18 | TERM cons25 19 | TERM console 20 | TERM cygwin 21 | TERM dtterm 22 | TERM eterm-color 23 | TERM gnome 24 | TERM gnome-256color 25 | TERM hurd 26 | TERM jfbterm 27 | TERM konsole 28 | TERM kterm 29 | TERM linux 30 | TERM linux-c 31 | TERM mach-color 32 | TERM mach-gnu-color 33 | TERM mlterm 34 | TERM putty 35 | TERM putty-256color 36 | TERM rxvt* 37 | TERM screen* 38 | TERM st 39 | TERM st-256color 40 | TERM terminator 41 | TERM tmux* 42 | TERM vt100 43 | TERM xterm* 44 | # Below are the color init strings for the basic file types. A color init 45 | # string consists of one or more of the following numeric codes: 46 | # Attribute codes: 47 | # 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed 48 | # Text color codes: 49 | # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white 50 | # Background color codes: 51 | # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white 52 | #NORMAL 00 # no color code at all 53 | #FILE 00 # regular file: use no color at all 54 | RESET 0 # reset to "normal" color 55 | DIR 01;34 # directory 56 | LINK 01;36 # symbolic link. (If you set this to 'target' instead of a 57 | # numerical value, the color is as for the file pointed to.) 58 | MULTIHARDLINK 00 # regular file with more than one link 59 | FIFO 40;33 # pipe 60 | SOCK 01;35 # socket 61 | DOOR 01;35 # door 62 | BLK 40;33;01 # block device driver 63 | CHR 40;33;01 # character device driver 64 | ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ... 65 | MISSING 00 # ... and the files they point to 66 | SETUID 37;41 # file that is setuid (u+s) 67 | SETGID 30;43 # file that is setgid (g+s) 68 | CAPABILITY 30;41 # file with capability 69 | STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) 70 | OTHER_WRITABLE 34;47 # dir that is other-writable (o+w) and not sticky 71 | STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable 72 | # This is for files with execute permission: 73 | EXEC 01;32 74 | # List any file extensions like '.gz' or '.tar' that you would like ls 75 | # to colorize below. Put the extension, a space, and the color init string. 76 | # (and any comments you want to add after a '#') 77 | # If you use DOS-style suffixes, you may want to uncomment the following: 78 | #.cmd 01;32 # executables (bright green) 79 | #.exe 01;32 80 | #.com 01;32 81 | #.btm 01;32 82 | #.bat 01;32 83 | # Or if you want to colorize scripts even if they do not have the 84 | # executable bit actually set. 85 | #.sh 01;32 86 | #.csh 01;32 87 | # archives or compressed (bright red) 88 | .tar 01;31 89 | .tgz 01;31 90 | .arc 01;31 91 | .arj 01;31 92 | .taz 01;31 93 | .lha 01;31 94 | .lz4 01;31 95 | .lzh 01;31 96 | .lzma 01;31 97 | .tlz 01;31 98 | .txz 01;31 99 | .tzo 01;31 100 | .t7z 01;31 101 | .zip 01;31 102 | .z 01;31 103 | .Z 01;31 104 | .dz 01;31 105 | .gz 01;31 106 | .lrz 01;31 107 | .lz 01;31 108 | .lzo 01;31 109 | .xz 01;31 110 | .bz2 01;31 111 | .bz 01;31 112 | .tbz 01;31 113 | .tbz2 01;31 114 | .tz 01;31 115 | .deb 01;31 116 | .rpm 01;31 117 | .jar 01;31 118 | .war 01;31 119 | .ear 01;31 120 | .sar 01;31 121 | .rar 01;31 122 | .alz 01;31 123 | .ace 01;31 124 | .zoo 01;31 125 | .cpio 01;31 126 | .7z 01;31 127 | .rz 01;31 128 | .cab 01;31 129 | # image formats 130 | .jpg 01;35 131 | .jpeg 01;35 132 | .gif 01;35 133 | .bmp 01;35 134 | .pbm 01;35 135 | .pgm 01;35 136 | .ppm 01;35 137 | .tga 01;35 138 | .xbm 01;35 139 | .xpm 01;35 140 | .tif 01;35 141 | .tiff 01;35 142 | .png 01;35 143 | .svg 01;35 144 | .svgz 01;35 145 | .mng 01;35 146 | .pcx 01;35 147 | .mov 01;35 148 | .mpg 01;35 149 | .mpeg 01;35 150 | .m2v 01;35 151 | .mkv 01;35 152 | .webm 01;35 153 | .ogm 01;35 154 | .mp4 01;35 155 | .m4v 01;35 156 | .mp4v 01;35 157 | .vob 01;35 158 | .qt 01;35 159 | .nuv 01;35 160 | .wmv 01;35 161 | .asf 01;35 162 | .rm 01;35 163 | .rmvb 01;35 164 | .flc 01;35 165 | .avi 01;35 166 | .fli 01;35 167 | .flv 01;35 168 | .gl 01;35 169 | .dl 01;35 170 | .xcf 01;35 171 | .xwd 01;35 172 | .yuv 01;35 173 | .cgm 01;35 174 | .emf 01;35 175 | # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions 176 | .ogv 01;35 177 | .ogx 01;35 178 | # audio formats 179 | .aac 00;36 180 | .au 00;36 181 | .flac 00;36 182 | .m4a 00;36 183 | .mid 00;36 184 | .midi 00;36 185 | .mka 00;36 186 | .mp3 00;36 187 | .mpc 00;36 188 | .ogg 00;36 189 | .ra 00;36 190 | .wav 00;36 191 | # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions 192 | .oga 00;36 193 | .opus 00;36 194 | .spx 00;36 195 | .xspf 00;36 196 | -------------------------------------------------------------------------------- /dot/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = mpadge 3 | email = mark.padgham@email.com 4 | [core] 5 | autocrlf = input 6 | safecrlf = true 7 | [alias] 8 | co = checkout 9 | ci = commit 10 | st = status -uno 11 | br = branch 12 | hist = log --graph --all --date=short --pretty=format:'%Cred%h%Creset%x09%ad - %Cgreen%d%Cblue%s%Creset' 13 | type = cat-file -t 14 | dump = cat-file -p 15 | 16 | [push] 17 | default = simple 18 | -------------------------------------------------------------------------------- /dot/.inputrc: -------------------------------------------------------------------------------- 1 | Tab:complete 2 | "\e[Z":menu-complete 3 | set completion-ignore-case on 4 | -------------------------------------------------------------------------------- /dot/.tmux.conf: -------------------------------------------------------------------------------- 1 | # set prefix key to ctrl+a 2 | unbind C-b 3 | set -g prefix C-a 4 | set -g base-index 1 # start window index at 1 - essential for tmuxinator! 5 | set -g set-titles on 6 | #set -g set-titles-string "tmux.#I.#W" 7 | set-window-option -g mode-keys vi 8 | 9 | set -g status-justify centre # left 10 | setw -g automatic-rename off # don't rename windows 11 | 12 | # I don't use these much, but they're here anyway 13 | # bind-key a send-prefix 14 | bind-key C-a last-window 15 | bind-key k confirm kill-window 16 | bind-key K confirm kill-server 17 | bind-key b set-option status 18 | bind '~' split-window "exec htop" 19 | 20 | # These ones are more useful 21 | bind-key -n C-right next 22 | bind-key -n C-left prev 23 | bind / command-prompt "split-window 'exec man %%'" 24 | 25 | set -g history-limit 5000 26 | # listen for activity on all windows 27 | set -g bell-action any 28 | # on-screen time for display-panes in ms 29 | set -g display-panes-time 2000 30 | set -g display-time 3000 31 | 32 | # Set split and new windows to start in current dir 33 | bind '"' split-window -c "#{pane_current_path}" 34 | bind % split-window -h -c "#{pane_current_path}" 35 | bind c new-window -c "#{pane_current_path}" 36 | 37 | 38 | #### ---------------------------- COLOUR (Solarized light) 39 | #### from https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-light.conf 40 | #### all of this and much other stuff is over-written by tmuxline 41 | 42 | # default statusbar colors 43 | set-option -g status-bg white #base2 44 | set-option -g status-fg yellow #yellow 45 | set-option -g status-attr default 46 | 47 | # default window title colors 48 | set-window-option -g window-status-fg brightyellow #base00 49 | set-window-option -g window-status-bg default 50 | set-window-option -g window-status-attr dim 51 | 52 | # active window title colors 53 | set-window-option -g window-status-current-fg brightred #orange 54 | set-window-option -g window-status-current-bg green 55 | set-window-option -g window-status-current-attr bright 56 | 57 | # pane border 58 | set-option -g pane-border-fg white #base2 59 | set-option -g pane-active-border-fg brightcyan #base1 60 | 61 | # message text 62 | set-option -g message-bg white #base2 63 | set-option -g message-fg brightred #orange 64 | 65 | # pane number display 66 | set-option -g display-panes-active-colour blue #blue 67 | set-option -g display-panes-colour brightred #orange 68 | 69 | # clock 70 | set-window-option -g clock-mode-colour green #green 71 | #### ---------------------------- END COLOUR (Solarized light) 72 | 73 | #### ---------------------------- COLOUR (Solarized light) 74 | #### from https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-light.conf 75 | 76 | 77 | # show some useful stats but only when tmux is started 78 | # outside of Xorg, otherwise dwm statusbar shows these already 79 | # set -g status-right "" # ThG: conflicts with time display 80 | set -g status-left "" 81 | if '[ -z "$DISPLAY" ]' 'set -g status-left "[#[fg=green] #H #[default]]"' 82 | if '[ -z "$DISPLAY" ]' 'set -g status-right "[ #[fg=magenta]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ][ #[fg=cyan,bright]%a %Y-%m-%d %H:%M #[default]]"' 83 | if '[ -z "$DISPLAY" ]' 'set -g status-right-length 50' 84 | 85 | # Maximizing and restoring panes. 86 | unbind + 87 | bind + new-window -d -n tmp \; swap-pane -s tmp.0 \; select-window -t tmp 88 | unbind - 89 | bind - last-window \; swap-pane -s tmp.0 \; kill-window -t tmp 90 | 91 | # auto setup tmux pane configs: 92 | #bind D source-file /home/markus/mytmux 93 | -------------------------------------------------------------------------------- /dot/.vimrc: -------------------------------------------------------------------------------- 1 | " ~./.vimrc 2 | " 3 | runtime! debian.vim 4 | " sets 'nocompatible' 5 | set nocompatible 6 | filetype off 7 | 8 | set rtp+=~/.vim/bundle/Vundle.vim 9 | call vundle#begin() 10 | Plugin 'VundleVim/Vundle.vim' 11 | Plugin 'Valloric/YouCompleteMe' 12 | Plugin 'vim-syntastic/syntastic' 13 | Plugin 'jalvesaq/Nvim-R' 14 | Plugin 'altercation/vim-colors-solarized' 15 | Plugin 'tyru/open-browser.vim' 16 | Plugin 'airblade/vim-gitgutter' 17 | Plugin 'vim-airline/vim-airline' 18 | Plugin 'vim-airline/vim-airline-themes' 19 | Plugin 'edkolev/tmuxline.vim' 20 | Plugin 'jimhester/lintr' 21 | Plugin 'mkitt/tabline.vim' 22 | Plugin 'kannokanno/previm' 23 | call vundle#end() 24 | filetype plugin indent on 25 | 26 | "execute pathogen#infect() 27 | 28 | if has("syntax") 29 | syntax on 30 | endif 31 | 32 | if has ('gui_running') 33 | set background=light 34 | else 35 | set background=dark 36 | "set background=light 37 | endif 38 | set background=dark 39 | set t_Co=16 40 | let g:solarized_termcolors=16 41 | colorscheme solarized 42 | "colorscheme monokai 43 | 44 | if has("autocmd") 45 | " Jump to the last position when reopening a file 46 | "au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 47 | " Load indentation rules and plugins according to the detected filetype. 48 | " Note these are essential for r-plugin! 49 | filetype plugin on 50 | " filetype indent on " set above for vundle 51 | endif 52 | 53 | set showcmd " Show (partial) command in status line. 54 | set showmatch " Show matching brackets. 55 | set ignorecase " Do case insensitive matching 56 | set smartcase " Do smart case matching 57 | set incsearch " Incremental search 58 | "set autowrite " Automatically save before commands like :next and :make 59 | "set hidden " Hide buffers when they are abandoned 60 | 61 | " Source a global configuration file if available 62 | if filereadable("/etc/vim/vimrc.local") 63 | source /etc/vim/vimrc.local 64 | endif 65 | 66 | " Extra config lines 67 | set modelines=0 68 | set tabstop=4 69 | set shiftwidth=4 70 | set softtabstop=4 71 | set expandtab 72 | set autoindent 73 | set ruler 74 | "set relativenumber 75 | set nu "line numbering 76 | set wrap 77 | set textwidth=80 78 | set colorcolumn=84 79 | set undofile 80 | "global searches, so :%s/foo/bar/g automatically becomes :%s/foo/bar 81 | set gdefault 82 | "automatically highlight searching 83 | set hlsearch 84 | " Height of the command bar 85 | set cmdheight=1 86 | set backspace=indent,eol,start 87 | 88 | 89 | 90 | "------------------------------------ 91 | " Behavior 92 | "------------------------------------ 93 | let maplocalleader = "," 94 | let mapleader = ";" 95 | "let g:mapleader = "," 96 | "set foldenable 97 | 98 | 99 | "------------------------------------ 100 | " Remaps 101 | "------------------------------------ 102 | nnoremap :nohls 103 | noremap :!make 104 | nmap w :w! 105 | nmap :qa 106 | " syntastic 107 | nmap [l :lprev 108 | nmap ]l :lnext 109 | 110 | " openbrowser maps: 111 | nmap gx (openbrowser-smart-search) 112 | vmap gx (openbrowser-smart-search) 113 | nmap gw (openbrowser-open) 114 | vmap gw (openbrowser-open) 115 | 116 | " Next 2 lines make tab match brackets instead of % 117 | nnoremap % 118 | vnoremap % 119 | 120 | "------------------------------------ 121 | " Showmarks 122 | "------------------------------------ 123 | let Tlist_Ctags_Cmd = '/usr/bin/ctags-exuberant' 124 | let marksCloseWhenSelected = 0 125 | let showmarks_include="abcdefghijklmnopqrstuvwxyz" 126 | 127 | "------------------------------------ 128 | " ExploreMode (instead of NERDTree) mapped to F2 129 | " Note that help doesn't work, but just search "vim netrw" or see here: 130 | " https://medium.com/@mozhuuuuu/vimmers-you-dont-need-nerdtree-18f627b561c3 131 | "------------------------------------ 132 | function MyExplore() 133 | tabnew 134 | Explore 135 | nmap q :q 136 | endfunction 137 | 138 | nmap :call MyExplore() 139 | 140 | "---------------------------------------- 141 | "------------- airline --------------- 142 | "---------------------------------------- 143 | 144 | set laststatus=2 145 | " configure vim-airline 146 | " let g:airline_theme='term' 147 | "let g:airline_theme='solarized' 148 | let g:airline_theme='sol' 149 | " show all open buffers on top 150 | let g:airline#extensions#tabline#enabled = 1 151 | let g:airline#extensions#tabline#tab_nr_type = 1 152 | " nice looking things 153 | let g:airline_left_sep = '' 154 | let g:airline_left_alt_sep = '' 155 | let g:airline_right_sep = '' 156 | let g:airline_right_alt_sep = '' 157 | let g:airline#extensions#tabline#left_sep = '' 158 | let g:airline#extensions#tabline#left_alt_sep = '|' 159 | if !exists('g:airline_symbols') 160 | let g:airline_symbols = {} 161 | endif 162 | let g:airline_symbols.branch = '' 163 | let g:airline_symbols.readonly = '' 164 | 165 | set wildmenu 166 | set wildmode=list:full 167 | 168 | 169 | "---------------------------------------- 170 | "------------- Nvim-R --------------- 171 | "---------------------------------------- 172 | 173 | " https://github.com/jcfaria/Vim-R-plugin/issues/204 174 | let g:ScreenImpl = 'Tmux' 175 | let g:ScreenShellInitialFocus = 'shell' 176 | " send selection to R with space bar 177 | vmap RDSendSelection 178 | " send line to R with space bar 179 | nmap RDSendLine 180 | 181 | " stop the plugin remapping underscore to '->': 182 | let R_assign = 0 183 | 184 | let g:R_in_buffer = 0 185 | let g:R_applescript = 0 186 | let g:R_tmux_split = 1 187 | let g:R_rconsole_height = winheight(0) 188 | let g:R_rconsole_width = winwidth(0) / 2 189 | "let g:R_rconsole_width = 0 190 | "autocmd VimResized * let R_rconsole_width = winwidth(0) / 2 191 | let g:R_nvimpager = "horizontal" 192 | let R_args = ['--no-save', '--quiet'] 193 | let R_tmux_title = 'R' 194 | "let g:R_notmuxconf = 1 "use my .tmux.conf, not the Nvim-r one 195 | 196 | let r_syntax_folding = 1 197 | 198 | 199 | "------------------------------------------- 200 | "--------------- previm ---------------- 201 | "------------------------------------------- 202 | 203 | "augroup PrevimSettings 204 | " autocmd! 205 | " autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown 206 | "augroup END 207 | 208 | nnoremap m :PrevimOpen 209 | 210 | "------------------------------------------- 211 | "------------- syntastic --------------- 212 | "------------------------------------------- 213 | 214 | set statusline+=%#warningmsg# 215 | set statusline+=%{SyntasticStatuslineFlag()} 216 | set statusline+=%* 217 | 218 | let g:syntastic_always_populate_loc_list = 1 219 | let g:syntastic_auto_loc_list = 1 220 | let g:syntastic_check_on_open = 0 221 | let g:syntastic_check_on_w = 0 222 | let g:syntastic_check_on_wq = 0 223 | "let b:syntastic_mode = 0 " disable 224 | " http://stackoverflow.com/questions/20030603/vim-syntastic-how-to-disable-the-checker 225 | let g:syntastic_mode_map = { 226 | \ 'mode': 'active', 227 | \ 'active_filetypes': [], 228 | \ 'passive_filetypes': [] } 229 | nnoremap E :SyntasticCheck :SyntasticToggleMode 230 | "let g:syntastic_debug = 1 231 | " - open .cpp and :mes, :SyntasticInfo to get debug info 232 | " see https://github.com/vim-syntastic/syntastic/issues/1246 and 233 | " https://github.com/Valloric/YouCompleteMe#user-content-the-gycm_show_diagnostics_ui-option 234 | let g:ycm_show_diagnostics_ui = 0 235 | let g:syntastic_cpp_compiler = 'clang++' 236 | let g:syntastic_cpp_compiler_options = ' -std=c++14 -std=libc++' 237 | let g:syntastic_enable_cpp_check_header = 1 238 | let g:syntastic_enable_cpp_lint_checker = 1 239 | let g:syntastic_enable_cpp_clang_check = 1 240 | let g:syntastic_enable_cpp_clang_tidy = 1 241 | let g:syntastic_cpp_checkers = ['gcc', 'clang_check', 'clang_tidy', 'cpp_lint'] 242 | 243 | let g:syntastic_cpp_clang_check_quiet_messages = {"regex": 244 | \ ['file not found']} 245 | 246 | " jimhester/lintr: 247 | let g:syntastic_enable_r_lintr_checker = 1 248 | let g:syntastic_r_checkers = ['lintr'] 249 | let g:syntastic_enable_rmd_lintr_checker = 1 250 | let g:syntastic_rmd_checkers = ['lintr'] 251 | function! SyntasticCheckHook(errors) 252 | if !empty(a:errors) 253 | let g:syntastic_loc_list_height = min([len(a:errors), 10]) 254 | endif 255 | endfunction 256 | 257 | let g:syntastic_r_lintr_quiet_messages = {"regex": 258 | \ ['Only use double-quotes.', 'Opening curly braces should never', 259 | \ 'No visible global function definition', 'Commented code should be removed']} 260 | let g:syntastic_rmd_lintr_quiet_messages = {"regex": 261 | \ ['Only use double-quotes.', 'Opening curly braces should never', 262 | \ 'No visible global function definition', 'Commented code should be removed']} 263 | " syntastic has :Error, so this is required for :E to work again 264 | " (https://github.com/vim-syntastic/syntastic/issues/164) 265 | command E Ex 266 | 267 | "------------------------------------------- 268 | "------------- vim-latex --------------- 269 | "------------------------------------------- 270 | 271 | " Set grep program to always generate a file-name. 272 | set grepprg=grep\ -nH\ $* 273 | 274 | " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to 275 | " 'plaintex' instead of 'tex', which results in vim-latex not being loaded. 276 | " The following changes the default filetype back to 'tex': 277 | let g:tex_flavor='latex' 278 | 279 | autocmd BufRead,BufNewFile *.tex call CheckFileType() 280 | function! CheckFileType() 281 | set textwidth=144 282 | set colorcolumn=150 283 | endfunction 284 | 285 | " set same widths for text files too 286 | autocmd BufNewFile,BufRead *.txt set textwidth=144 | set colorcolumn=150 287 | 288 | " =============== WORD COUNT FUNCTION ============= 289 | " From http://stackoverflow.com/questions/2974954/correct-word-count-of-a-latex-document 290 | " with modifications from: 291 | " http://tex.stackexchange.com/questions/534/is-there-any-way-to-do-a-correct-word-count-of-a-latex-document 292 | " NOTE that this is globally defined for ALL filetypes, and may muck up other mappings! 293 | :map :call WC() 294 | function! WC() 295 | let filename = expand("%") 296 | "let cmd = "detex " . filename . " | wc -w | perl -pe 'chomp; s/ +//;'" 297 | let cmd = "detex " . filename . " | wc -w | tr -d [:space:]" 298 | let result = system(cmd) 299 | echo result . " words" 300 | endfunction 301 | " g just counts words of a selection, but does not detex. 302 | 303 | " NOTE that the above WC() function seems to give really rubbish estimates. 304 | " A superior alternative is texcount, gives far more detail, for which see 305 | " http://app.uio.no/ifi/texcount/howto.html 306 | " To run it, just type :!texcount % 307 | " It takes a while, but is far more accurate. It is nevertheless not really 308 | " accurate, because it still counted far more words that those remaining when all 309 | " major environments were excised. This is nevertheless possibly just because of 310 | " \itemize, lists, and so on, so it seems to be the best way for the moment. 311 | 312 | 313 | " =============== SPELL CHECKING ============= 314 | " NOTE that spell stopped working with .tex at some stage, and can be fixed by 315 | " entering :syn spell toplevel. To avoid having to manually enter this every 316 | " time, follow the instructions in ":h mysyntaxfile-add": 317 | " Make a new directory in /.vim/after/sytax, with "tex.vim" holding this syn 318 | " command. 319 | " The mysyntaxfile-add instructions also have lots of details about custom 320 | " colour highlight schemes and the likes. 321 | -------------------------------------------------------------------------------- /functions/aptadd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # recieve new apt keys 4 | function addkeys { 5 | keys_added=false 6 | while read F 7 | do 8 | EX=$(apt-key list | grep -w $F) 9 | if [ "" == $EX ] 10 | then 11 | show_info 'adding keys ... ' $(cat $KEYS) 12 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $(cat $KEYS) 13 | keys_added=true 14 | fi 15 | done < $KEYS 16 | # clang from apt.llvm.org 17 | wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - 18 | if $keys_added 19 | then 20 | sudo apt-get update 21 | show_success 'apt keys added' 22 | fi 23 | } 24 | 25 | # add new apt repositories 26 | function addrepos { 27 | repos_added=false 28 | while read F 29 | do 30 | REX=grep "$F" /etc/apt/sources.list 31 | if [ "" == "$REX" ] 32 | then 33 | show_info 'adding repos ... ' "$(cat $REPOS)" 34 | sudo add-apt-repository "$F" 35 | repos_added=true 36 | fi 37 | done < $REPOS 38 | 39 | if $repos_added 40 | then 41 | sudo apt-get update 42 | sudo apt-get upgrade 43 | show_success 'apt repositories added' 44 | fi 45 | } 46 | 47 | # Install packages listed in 'data/packages.list' 48 | function addapt { 49 | if (eval `resize` && whiptail \ 50 | --title "Apt Repositories" \ 51 | --yesno "apt keys to recieve: \n\n$(cat $KEYS) \n\nRepositories to add: \n\n$(cat $REPOS)" \ 52 | $LINES $COLUMNS $(( $LINES - 12 )) \ 53 | --scrolltext) then 54 | show_info 'Installing...' 55 | show_warning 'Requires root privileges' 56 | addkeys 57 | addrepos 58 | 59 | # Done 60 | show_success 'Done.' 61 | # Check 62 | EXITSTATUS=$1 63 | if [[ $EXITSTATUS != 0 ]]; then 64 | # Already installed 65 | show_success 'Already installed.' 66 | whiptail --title "Finished" --msgbox "apt keys and repositories added." 8 78 67 | main 68 | else 69 | whiptail --title "Finished" --msgbox "Installation complete." 8 78 70 | main 71 | fi 72 | else 73 | main 74 | fi 75 | } 76 | -------------------------------------------------------------------------------- /functions/check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check if command failed, if true abort 4 | function check_fail { 5 | EXITSTATUS=$1 6 | if [[ $EXITSTATUS != 0 ]]; then 7 | show_error "Something may have went wrong during the last command. Returning." 8 | sleep 3s && main 9 | fi 10 | } 11 | 12 | # Check for and install required packages for this script set. 13 | function check_dependencies { 14 | show_info "Checking dependencies..." 15 | for package in $(cat $DEPS) 16 | do 17 | PKGCHECK=$(dpkg-query -W --showformat='${Status}\n' $package|grep "install ok installed") 18 | if [ "" == "$PKGCHECK" ]; then 19 | show_info $NAME 'is not installed. Proceeding' 20 | show_info "This script requires '$package' and it is not present on your system." 21 | show_question 'Would you like to install it to continue? (Y)es, (N)o : ' && read REPLY 22 | echo '' 23 | case $REPLY in 24 | # Positive action 25 | [Yy]* ) 26 | show_warning 'Requires root privileges' 27 | sudo apt-get -y install $package 28 | # Failure check 29 | check_fail 30 | show_success "Package '$package' installed. Proceeding." 31 | ;; 32 | # Negative action 33 | [Nn]* ) 34 | show_info "Exiting..." 35 | exit 99 36 | ;; 37 | # Error 38 | * ) 39 | show_error '\aSorry, try again.' && check 40 | ;; 41 | esac 42 | else 43 | show_success "Package '$package' is installed." 44 | fi 45 | done 46 | show_info "Proceeding." 47 | } 48 | -------------------------------------------------------------------------------- /functions/cleanup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Remove unused/unwanted packages that are listed in 'data/purge.list' 4 | function unused { 5 | if (eval `resize` && whiptail \ 6 | --title "Remove Un-used Pre-installed Applications" \ 7 | --yesno "Current list of pre-installed applications to remove: \n\n$(cat $PURGED) \n\nAre you sure you want proceed?" \ 8 | $LINES $COLUMNS $(( $LINES - 12 )) \ 9 | --scrolltext ) then 10 | show_info 'Removing unused pre-installed applications...' 11 | show_warning 'Requires root privileges' 12 | sudo apt-get remove -y $(cat $PURGED) 13 | # Done 14 | show_success 'Done.' 15 | whiptail --title "Finished" --msgbox "Your list of unwanted pre-installed applications have been removed." 8 78 16 | cleanup 17 | else 18 | cleanup 19 | fi 20 | } 21 | 22 | # Remove old kernels 23 | function kernels { 24 | if (whiptail --title "Remove Outdated Kernels" --yesno "If you're not currently using the newest kernel installed on your system, the following may break it. \n\nAre you sure you want proceed?" 10 60) then 25 | show_info 'Removing outdated kernel(s)...' 26 | show_warning 'Requires root privileges' 27 | sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | grep -v linux-libc-dev | xargs sudo apt-get -y --no-install-recommends purge 28 | show_success 'Done.' 29 | whiptail --title "Finished" --msgbox "Outdated kernels have been successfully removed." 8 78 30 | cleanup 31 | else 32 | cleanup 33 | fi 34 | } 35 | 36 | # Remove Orphaned Packages 37 | function orphaned { 38 | show_info 'Removing orphaned packages...' 39 | show_warning 'Requires root privileges' 40 | sudo apt-get autoremove -y 41 | show_success 'Done.' 42 | whiptail --title "Finished" --msgbox "Orphaned packages have been successfully removed." 8 78 43 | cleanup 44 | } 45 | 46 | # Remove Leftover Config files 47 | function leftovers { 48 | show_info 'Removing leftover configuration files...' 49 | show_warning 'Requires root privileges' 50 | sudo dpkg --purge $(COLUMNS=200 dpkg -l | grep '^rc' | tr -s ' ' | cut -d ' ' -f 2) 51 | show_success 'Done.' 52 | # Check 53 | whiptail --title "Finished" --msgbox "Leftover configuration files have been removed." 8 78 54 | cleanup 55 | } 56 | 57 | # Clean apt cache 58 | function clean-cache { 59 | show_info 'Cleaning package cache...' 60 | show_warning 'Requires root privileges' 61 | sudo apt-get clean 62 | show_success 'Done.' 63 | whiptail --title "Finished" --msgbox "Package cache has been cleaned." 8 78 64 | cleanup 65 | } 66 | 67 | # Cleanup System 68 | function cleanup { 69 | eval `resize` 70 | CLEANUP=$(whiptail \ 71 | --notags \ 72 | --title "System Cleanup" \ 73 | --menu "\nWhat would you like to do?" \ 74 | --cancel-button "Go Back" \ 75 | $LINES $COLUMNS $(( $LINES - 12 )) \ 76 | clean-cache '1. Clean package cache' \ 77 | leftovers '2. Remove leftover configuration files' \ 78 | orphaned '3. Remove orphaned packages' \ 79 | unused '4. Remove unused pre-installed packages' \ 80 | kernels '5. Remove old kernel(s)' \ 81 | 3>&1 1>&2 2>&3) 82 | 83 | exitstatus=$? 84 | if [ $exitstatus = 0 ]; then 85 | $CLEANUP 86 | else 87 | main 88 | fi 89 | } 90 | -------------------------------------------------------------------------------- /functions/configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Automatically set preferred gsettings keys as outlined in the 'gsettings.list' file 4 | function set_preferences { 5 | show_info 'Setting preferred application-specific & desktop settings...' 6 | while IFS= read line 7 | do 8 | eval gsettings set $line 9 | done < "$GSETTINGS" 10 | while IFS= read line 11 | do 12 | eval dconf write $line 13 | done < "$DSETTINGS" 14 | export EDITOR='vim' 15 | # Change "Ubuntu desktop" text at top left of screen to "msgstr" below 16 | # http://askubuntu.com/questions/140742/how-do-i-change-the-desktop-name-on-the-unity-panel 17 | cat <~/.junk.po 18 | msgid "Ubuntu Desktop" 19 | msgstr "o---o" 20 | EOF 21 | sudo msgfmt -o /usr/share/locale/en/LC_MESSAGES/unity.mo ~/.junk.po 22 | } 23 | 24 | function preferences { 25 | set_preferences 26 | # Done 27 | show_success 'Done.' 28 | whiptail --title "Finished" --msgbox "Settings changed successfully." 8 78 29 | configure 30 | } 31 | 32 | # dot files 33 | function dotfiles { 34 | if [ ! -d ~/.R ]; then 35 | mkdir ~/.R 36 | fi 37 | if [ ! -d ~/.ccache ]; then 38 | mkdir ~/.ccache 39 | fi 40 | 41 | show_info 'Downloading dot-files...' 42 | WD=$PWD 43 | eval cd $HOME 44 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.Renviron 45 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.Rprofile 46 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.bashrc 47 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.tmux.conf 48 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.vimrc 49 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.gitconfig 50 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.inputrc 51 | 52 | eval cd $HOME/.R 53 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.R/Makevars 54 | eval cd $WD 55 | eval cd $HOME/.ccache 56 | curl -O https://raw.githubusercontent.com/mpadge/ubuntu-setup/master/dot/.ccache/ccache.conf 57 | eval cd $WD 58 | 59 | # Done 60 | show_success 'Done.' 61 | whiptail --title "Finished" --msgbox "dot files downloaded successfully." 8 78 62 | configure 63 | } 64 | 65 | # dot files copy 66 | function dotfiles_cp { 67 | show_info 'Copying dot-files to git repo...' 68 | 69 | cp $HOME/.bash_aliases $DIR/dot/.bash_aliases 70 | 71 | cp $HOME/.bash_aliases $DIR/dot/.bash_aliases 72 | cp $HOME/.Rprofile $DIR/dot/.Rprofile 73 | cp $HOME/.Renviron $DIR/dot/.Renviron 74 | cp $HOME/.bashrc $DIR/dot/.bashrc 75 | cp $HOME/.vimrc $DIR/dot/.vimrc 76 | cp $HOME/.tmux.conf $DIR/dot/.tmux.conf 77 | cp $HOME/.gitconfig $DIR/dot/.gitconfig 78 | cp $HOME/.inputrc $DIR/dot/.inputrc 79 | 80 | cp $HOME/.R/Makevars $DIR/dot/.R/Makevars 81 | cp $HOME/.ccache/ccache.conf $DIR/dot/.ccache/ccache.conf 82 | 83 | # Done 84 | show_success 'Done.' 85 | whiptail --title "Finished" --msgbox "dot files copied successfully." 8 78 86 | configure 87 | } 88 | 89 | # Configure System 90 | function configure { 91 | eval `resize` 92 | CONF=$(whiptail \ 93 | --notags \ 94 | --title "Configure System" \ 95 | --menu "\nWhat would you like to do?" \ 96 | --cancel-button "Go Back" \ 97 | $LINES $COLUMNS $(( $LINES - 12 )) \ 98 | preferences '1. Set preferred application-specific & desktop settings' \ 99 | dotfiles '2. Download/replace all dotfiles' \ 100 | dotfiles_cp '3. Copy dotfiles to git repo' \ 101 | 3>&1 1>&2 2>&3) 102 | 103 | exitstatus=$? 104 | if [ $exitstatus = 0 ]; then 105 | $CONF 106 | else 107 | main 108 | fi 109 | } 110 | -------------------------------------------------------------------------------- /functions/doall: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source $DIR/functions/non-apt/instvim 4 | source $DIR/functions/non-apt/instpandoc 5 | source $DIR/functions/non-apt/instpython 6 | source $DIR/functions/non-apt/sourcecodepro 7 | source $DIR/functions/non-apt/travis 8 | source $DIR/functions/non-apt/rpackages 9 | 10 | # Install packages listed in 'data/packages.list' 11 | function doall { 12 | whiptail --title "NOTE" --msgbox "Prior to running doall, software-properties-common may need to be reinstalled - check first!" 8 78 13 | show_info "check with $ apt-get install software-properties-common" 14 | if (eval `resize` && whiptail \ 15 | --title "Everything" \ 16 | --yesno "Install and setup whole system non-interactively?" \ 17 | $LINES $COLUMNS $(( $LINES - 12 )) \ 18 | --scrolltext) then 19 | 20 | # ---repeated sudo -nv to update sudo timestamp 21 | sudo -nv 22 | 23 | # ---aptadd 24 | addkeys 25 | addrepos 26 | 27 | # ---packages 28 | sudo -nv 29 | while read F ; do 30 | PF=$(echo $F | cut -d "#" -f 1) # cut comments from package names 31 | PKGCHECK=$(dpkg-query -W --showformat='${Status}\n' $PF|grep "install ok installed") 32 | if [ "" == "$PKGCHECK" ] 33 | then 34 | sudo apt-get install -y $PF 35 | else 36 | echo "package "$PF" already installed" 37 | fi 38 | done < $PKGS 39 | sudo R CMD javareconf 40 | gdal 41 | 42 | # ---nonapt 43 | sudo -nv 44 | set_preferences 45 | dotfiles 46 | 47 | # ---non-apt/instvim 48 | sudo -nv 49 | install_vim_core 50 | pathogen 51 | solarized 52 | # ---non-apt/pandoc 53 | sudo -nv 54 | install_pandoc_core 55 | # ---non-apt/sourcecodepro 56 | sudo -nv 57 | install_sourcecodepro 58 | # ---non-apt/travis 59 | sudo -nv 60 | sudo apt-get install -y ruby-dev 61 | sudo gem install travis --no-rdoc --no-ri 62 | # ---non-apt/rpackages 63 | sudo -nv 64 | if [ -d "$RLIBLOC" ]; then 65 | while read F ; do 66 | CMD='install.packages('\"$F\"',repos='\"$CRAN\"',lib.loc='\"$RLIBLOC\"')' 67 | echo sudo Rscript --verbose -e $CMD 68 | done < $RPKGS 69 | else 70 | while read F ; do 71 | CMD='install.packages('\"$F\"',repos='\"$CRAN\"')' 72 | sudo Rscript --verbose -e $CMD 73 | done < $RPKGS 74 | fi 75 | # ---non-apt/python 76 | sudo -nv 77 | install_python 78 | 79 | # Done 80 | show_success 'Done.' 81 | main 82 | else 83 | main 84 | fi 85 | } 86 | -------------------------------------------------------------------------------- /functions/non-apt/docker: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function install_docker { 4 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 5 | sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 6 | sudo apt-get update 7 | sudo apt-get install -y docker-ce 8 | } 9 | -------------------------------------------------------------------------------- /functions/non-apt/instpandoc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function install_pandoc_core { 4 | URL=$(curl -s https://api.github.com/repos/jgm/pandoc/releases | \ 5 | grep browser_download_url | head -n 1 | cut -d '"' -f 4) 6 | sudo wget $URL 7 | show_header 'installing '$NAME' ...' 8 | file=${URL#https://github.com/jgm/pandoc/releases/download/} 9 | file=${file#*/} 10 | sudo dpkg -i $file 11 | # Cleanup and finish 12 | rm -rf $file 13 | } 14 | 15 | # install_pandoc - not complete coz lacks version comparison 16 | function install_pandoc { 17 | # Variables 18 | PACKAGE=pandoc 19 | NAME="pandoc" 20 | PKGCHECK=$(dpkg-query -W --showformat='${Status}\n' $PACKAGE|grep "install ok installed") 21 | if [ "" == "$PKGCHECK" ]; then 22 | INST_UPDATE="installation" 23 | INST_UPDATE_VERB="Installing" 24 | else 25 | INST_UPDATE="update" 26 | INST_UPDATE_VERB="Updating" 27 | fi 28 | # Install 29 | show_header 'Begin '$NAME' '$INST_UPDATE 30 | install_pandoc_core 31 | # Done 32 | show_success 'Done.' 33 | whiptail --title "Finished" --msgbox "$INST_UPDATE_VERB $NAME complete." 8 78 34 | nonapt 35 | } 36 | -------------------------------------------------------------------------------- /functions/non-apt/instpython: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # install_python 4 | function install_python { 5 | for i in "${PYPKGS[@]}"; do 6 | if ! $(python -c "import $i" &> /dev/null) 7 | then 8 | echo "$i not there" 9 | #sudo apt-get install $i 10 | else 11 | echo "python-$i already installed" 12 | fi 13 | done 14 | 15 | PKGCHECK=$(dpkg-query -W --showformat='${Status}\n' python-pip|grep "install ok installed") 16 | if [ "" == "$PKGCHECK" ]; then 17 | sudo apt-get install -y python-pip 18 | fi 19 | #sudo pip install ipython 20 | #sudo pip install ipython-notebook # doesn't exist 21 | #sudo pip install slimit 22 | 23 | show_success 'Done.' 24 | nonapt 25 | } 26 | 27 | -------------------------------------------------------------------------------- /functions/non-apt/instvim: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PFILE=$HOME"/.vim/autoload/pathogen.vim" 4 | 5 | function install_vim_core { 6 | # This is mostly from 7 | # https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source 8 | sudo apt-get remove vim vim-runtime gvim 9 | # That doesn't really work because vim is compiled from source. The only way 10 | # I've found to remove it is to manually remove the "vim" directories from 11 | # "/usr/share", "/usr/local/share" and "/usr/local/bin" 12 | 13 | HDIR=0 14 | if [[ $PWD = $HOME ]] 15 | then 16 | cd ./Downloads # because .vim sits in home 17 | HDIR=1 18 | fi 19 | git clone https://github.com/vim/vim.git 20 | # Install package(s) 21 | show_info $INST_UPDATE_VERB' '$NAME'...' 22 | show_warning 'Requires root privileges' 23 | # ----- The "official" github.com/vim/vim way: 24 | #cd vim/src 25 | #make distclean 26 | #make 27 | #sudo make install 28 | # ----- Or the Valloric way (modified a bit) 29 | cd vim 30 | ./configure --with-features=huge \ 31 | --enable-multibyte \ 32 | --enable-python3interp=yes \ 33 | --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \ 34 | --enable-python3interp=yes \ 35 | --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \ 36 | --enable-gui=gtk2 --enable-cscope --prefix=/usr 37 | make VIMRUNTIMEDIR=/usr/share/vim/vim80 38 | #make 39 | sudo make install 40 | # Cleanup and finish 41 | cd .. 42 | rm -rf vim 43 | if [ $HDIR -eq 0 ] 44 | then 45 | cd .. 46 | fi 47 | } 48 | 49 | function pathogen { 50 | PNAME="pathogen" 51 | if [ ! -e $PFILE ]; then 52 | show_info 'installing '$PNAME 53 | mkdir -p ~/.vim/autoload ~/.vim/bundle && \ 54 | curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim 55 | else 56 | whiptail --title $PNAME --msgbox "$PNAME already installed." 8 78 57 | show_info $PNAME' already installed' 58 | fi 59 | } 60 | 61 | function solarized { 62 | PFILE=$HOME"/.vim/autoload/pathogen.vim" 63 | if [ ! -e $PFILE ]; then 64 | pathogen 65 | show_info 'installing '$PNAME 66 | fi 67 | SOLDIR=$HOME"/.vim/bundle/vim-colors-solarized/" 68 | SOLNAME="vim-colors-solarized" 69 | if [ -d $SOLDIR ]; then 70 | whiptail --title $SOLNAME --msgbox "$SOLNAME already installed." 8 78 71 | show_info "$SOLNAME already installed." 72 | else 73 | show_info "Installing "$SOLNAME 74 | pwd=$PWD 75 | cd $HOME/.vim/bundle 76 | git clone https://github.com/altercation/vim-colors-solarized.git 77 | cd vim-colors-solarized 78 | mv vim-colors-solarized $HOME/.vim/bundle 79 | cd $PWD 80 | fi 81 | } 82 | 83 | function monokai { 84 | VCDIR="$HOME/.vim/colors" 85 | if [ ! -d "$VCDIR" ]; then 86 | mkdir -p $VCDIR; 87 | fi 88 | MKFILE=$VCDIR/monokai.vim 89 | if [ ! -f $MKFILE ]; then 90 | git clone https://github.com/sickill/vim-monokai 91 | cp vim-monokai/colors/monokai.vim $MKFILE 92 | rm -rf vim-monokai 93 | else 94 | whiptail --title "monokai colours" --msgbox "monokai already installed." 8 78 95 | show_info 'monokai already installed' 96 | fi 97 | } 98 | 99 | function browswer { 100 | VBDIR="$HOME/.vim/bundle/open-browser.vim" 101 | 102 | if [ ! -d "$VBDIR" ]; then 103 | wd=$PWD 104 | cd $HOME/.vim/bundle && git clone https://github.com/tyru/open-browser.vim 105 | cd $wd 106 | else 107 | whiptail --title "open-browser.vim" --msgbox "open-browser already installed." 8 78 108 | show_info 'open-browser.vim already installed' 109 | fi 110 | } 111 | 112 | function vundle { 113 | VUNDIR=$HOME"/.vim/bundle/Vundle.vim/" 114 | VUNNAME="vundle" 115 | if [ -d $VUNDIR ]; then 116 | whiptail --title $VUNNAME --msgbox "$VUNNAME already installed." 8 78 117 | show_info "$VUNNAME already installed." 118 | else 119 | show_info "Installing "$VUNNAME 120 | git clone https://github.com/Valloric/YouCompleteMe $HOME/.vim/bundle/Vundle.vim 121 | fi 122 | } 123 | 124 | function ycm { 125 | YCMDIR=$HOME"/.vim/bundle/YouCompleteMe/" 126 | YCMNAME="YouCompleteMe" 127 | if [ -d $YCMDIR ]; then 128 | whiptail --title $YCMNAME --msgbox "$YCMNAME already installed." 8 78 129 | show_info "$YCMNAME already installed." 130 | else 131 | show_info "Installing "$YCMNAME 132 | #git clone https://github.com/Valloric/YouCompleteMe $hOME/.vim/bundle/YouCompleteMe 133 | vim +PluginInstall +qall 134 | $HOME/.vim/bundle/YouCompleteMe/install.py --clang-completer 135 | fi 136 | } 137 | 138 | function vimlatex { 139 | PKGCHECK=$(sudo vim-addons status | grep "latex suite" | grep "removed") 140 | if [ ! "" == "$PKGCHECK" ] 141 | then 142 | sudo vim-addons install -w latex-suite 143 | vim-addons install latex-suite 144 | else 145 | show_info "latex-suite already installed" 146 | whiptail --title "vim-latexsuite" --msgbox "vim-latexsuite already installed." 8 78 147 | fi 148 | } 149 | 150 | function nvimr { 151 | # Stable version at: 152 | # http://www.vim.org/scripts/script.php?script_id=2628 153 | # This is a pathogen install of the current git version 154 | NVRDIR=$HOME"/.vim/bundle/Nvim-R/" 155 | NVRNAME="nvim-r" 156 | if [ -d $NVRDIR ]; then 157 | whiptail --title $NVRNAME --msgbox "$NVRNAME already installed." 8 78 158 | show_info "$NVRNAME already installed." 159 | else 160 | show_info "Installing "$NVRNAME 161 | pwd=$PWD 162 | git clone https://github.com/jalvesaq/Nvim-R $NVRDIR 163 | fi 164 | } 165 | 166 | # install_vim 167 | function install_vim { 168 | # Variables 169 | PACKAGE=vim 170 | NAME="vim" 171 | PKGCHECK=$(dpkg-query -W --showformat='${Status}\n' $PACKAGE|grep "install ok installed") 172 | if [ "" == "$PKGCHECK" ]; then 173 | INST_UPDATE="installation" 174 | INST_UPDATE_VERB="Installing" 175 | else 176 | INST_UPDATE="update" 177 | INST_UPDATE_VERB="Updating" 178 | fi 179 | if (whiptail --title "vim" --yesno "Begin $NAME $INST_UPDATE?" 8 78) then 180 | # Install 181 | show_header 'Begin '$NAME' '$INST_UPDATE 182 | # Install git if not installed 183 | GITCHECK=$(dpkg-query -W --showformat='${Status}\n' git|grep "install ok installed") 184 | if [ "" == "$GITCHECK" ]; then 185 | echo 'installing git first ...' 186 | sudo apt-get install -y git 187 | fi 188 | install_vim_core 189 | fi 190 | 191 | pathogen 192 | solarized 193 | monokai 194 | browswer 195 | vundle 196 | ycm 197 | vim +PluginInstall +qall 198 | vimlatex 199 | nvimr 200 | 201 | # Done 202 | show_success 'Done.' 203 | #whiptail --title "Finished" --msgbox "$INST_UPDATE_VERB $NAME complete." 8 78 204 | nonapt 205 | } 206 | -------------------------------------------------------------------------------- /functions/non-apt/latex-pkgs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # These packages have necessary updated versions beyond those installed with 4 | # texlive. 5 | 6 | function latexpkgs { 7 | tcolorbox 8 | titlesec 9 | } 10 | 11 | function tcolorbox { 12 | TCNAME="tcolorbox" 13 | URL="http://mirrors.ctan.org/install/macros/latex/contrib/tcolorbox.tds.zip" 14 | show_header 'Downloading '$TCNAME 15 | sudo wget $URL 16 | unzip "tcolorbox.tds.zip" -d "tcolorbox" 17 | sudo cp -rf tcolorbox/tex/latex/tcolorbox/ /usr/share/texlive/texmf-dist/tex/latex/tcolorbox/ 18 | rm -rf tcolorbox tcolorbox.tds.zip 19 | } 20 | 21 | function titlesec { 22 | # Update from 2.10.1 -> 2.10.2 23 | # TODO: Delete this once texlive version == 2.10.2 24 | TSNAME="titlesec" 25 | URL="http://mirrors.ctan.org/install/macros/latex/contrib/titlesec.tds.zip" 26 | show_header 'Downloading '$TSNAME 27 | sudo wget $URL 28 | unzip "titlesec.tds.zip" -d "titlesec" 29 | sudo cp -rf titlesec/tex/latex/titlesec/ /usr/share/texlive/texmf-dist/tex/latex/titlesec/ 30 | rm -rf titlesec titlesec.tds.zip 31 | } 32 | -------------------------------------------------------------------------------- /functions/non-apt/rpackages: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # install R packages 4 | function rpackages { 5 | if [ -z $RPKGS_NI ] 6 | then 7 | whiptail --title "R packages" --msgbox "All R packages installed." 8 78 8 | nonapt 9 | elif (eval `resize` && whiptail \ 10 | --title "R Packages" \ 11 | --yesno "Current list of R packages to install: \n\n${RPKGS_NI[*]\\} \n\nProceed with installation?" \ 12 | $LINES $COLUMNS $(( $LINES - 12 )) \ 13 | --scrolltext) then 14 | show_header 'Installing...' 15 | show_warning 'Requires root privileges' 16 | if [ -d "$RLIBLOC" ]; then 17 | for i in ${RPKGS_NI[@]}; do 18 | CMD='install.packages('\"${i}\"',repos='\"$CRAN\"',lib='\"$RLIBLOC\"')' 19 | sudo Rscript --verbose -e $CMD 20 | done 21 | else 22 | for i in ${RPKGS_NI[@]}; do 23 | CMD='install.packages('\"${i}\"',repos='\"$CRAN\"')' 24 | sudo Rscript --verbose -e $CMD 25 | done 26 | fi 27 | 28 | # Done 29 | show_success 'Done.' 30 | nonapt 31 | else 32 | nonapt 33 | fi 34 | } 35 | -------------------------------------------------------------------------------- /functions/non-apt/sourcecodepro: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCDIR="/usr/share/fonts/opentype/Source Code Pro" 4 | 5 | function install_sourcecodepro { 6 | URL="https://github.com/adobe-fonts/source-code-pro/releases/latest" 7 | URL=$(curl -s $URL | grep 'href' | head -n 1 | cut -d '"' -f 2) 8 | # TODO: Improvide the next 3 lines: 9 | ARCHIVE=${URL/"https://github.com/adobe-fonts/"} 10 | ARCHIVE=${ARCHIVE/"releases/tag/"} 11 | ARCHIVE=${ARCHIVE////-} 12 | URL="https://github.com"$(curl -s $URL | grep '.tar.gz' | head -n 1 | cut -d '"' -f 2) 13 | show_header 'Downloading '$SCNAME 14 | wget $URL 15 | show_header 'installing '$SCNAME' ...' 16 | FILE=$(echo $URL | rev | head -n 1 | cut -d '/' -f 1 | rev) 17 | tar -xzf $FILE 18 | cd $ARCHIVE"/OTF" 19 | sudo mkdir "$SCDIR" 20 | sudo cp -r * "$SCDIR/" 21 | fc-cache -f -v 22 | gsettings set org.gnome.desktop.interface monospace-font-name 'Source Code Pro Light 9' 23 | 24 | # Cleanup and finish 25 | cd ../.. 26 | sudo rm -rf $FILE $ARCHIVE 27 | } 28 | 29 | 30 | # sourcecodepro 31 | function sourcecodepro { 32 | SCNAME="Source Code Pro" 33 | SCDIR="/usr/share/fonts/opentype/Source Code Pro" 34 | 35 | if [ -d "$SCDIR" ]; then 36 | show_info $SCNAME' already installed' 37 | whiptail --title "$SCNAME" --msgbox "$SCNAME already installed." 8 78 38 | nonapt 39 | else 40 | install_sourcecodepro 41 | # Done 42 | show_success 'Done.' 43 | whiptail --title "Finished" --msgbox "Installing $SCNAME complete." 8 78 44 | nonapt 45 | fi 46 | } 47 | -------------------------------------------------------------------------------- /functions/non-apt/travis: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # travis client from github.com/travis-ci/travis.rb 4 | function travis { 5 | # Variables 6 | PACKAGE=travis 7 | TNAME="travis" 8 | 9 | # First check ruby-dev 10 | RUBY="ruby-dev" 11 | PKGCHECK=$(dpkg-query -W --showformat='${Status}\n' $RUBY|grep "install ok installed") 12 | if [ "" == "$PKGCHECK" ]; then 13 | show_info "travis-ci client requires ruby-dev installation" 14 | sudo apt-get install -y ruby-dev 15 | else 16 | show_info "ruby-dev installed as required for travis gem ..." 17 | fi 18 | 19 | # Install 20 | if hash $TNAME 2>/dev/null; then 21 | TRCURRENT=`echo $(gem list --no-verbose travis) | cut -d "(" -f2 | cut -d ")" -f1` 22 | VONE=$(echo $TRCURRENT | cut -d '.' -f 1) 23 | VTWO=$(echo $TRCURRENT | cut -d '.' -f 2) 24 | VTHREE=$(echo $TRCURRENT | cut -d '.' -f 3) 25 | URL="https://api.github.com/repos/travis-ci/travis.rb/tags" 26 | TRLATEST=$(curl -s $URL | grep "tarball_url" | head -n 1 | cut -d '"' -f 4) 27 | TRLATEST=${TRLATEST##*/v} 28 | #LATEST=${LATEST%.*} 29 | LONE=$(echo $TRLATEST | cut -d '.' -f 1) 30 | LTWO=$(echo $TRLATEST | cut -d '.' -f 2) 31 | LTHREE=$(echo $TRLATEST | cut -d '.' -f 3) 32 | 33 | if ((LONE==VONE)) && ((LTWO==VTWO)) && ((LTHREE==VTHREE)) 34 | then 35 | whiptail --title "$TNAME version" --msgbox "version is latest: $TRLATEST" 8 50 36 | elif (whiptail --title "$TNAME update" \ 37 | --yesno "Proceed with $TNAME update from $TRCURRENT to $TRLATEST?" 10 60) 38 | then 39 | show_info $TRCURRENT 40 | show_info 'updating '$TNAME' from '$TRCURRENT' to '$TRLATEST 41 | sudo gem install travis --no-rdoc --no-ri 42 | sudo gem cleanup travis 43 | fi 44 | elif (whiptail --title "$TNAME install" --yesno "Install $TNAME?" 10 60) 45 | then 46 | sudo gem install travis --no-rdoc --no-ri 47 | fi 48 | # Done 49 | nonapt 50 | } 51 | -------------------------------------------------------------------------------- /functions/nonapt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $DIR/functions/non-apt/instvim 4 | . $DIR/functions/non-apt/instpandoc 5 | . $DIR/functions/non-apt/instpython 6 | . $DIR/functions/non-apt/docker 7 | . $DIR/functions/non-apt/sourcecodepro 8 | . $DIR/functions/non-apt/travis 9 | . $DIR/functions/non-apt/rpackages 10 | . $DIR/functions/non-apt/latex-pkgs 11 | 12 | # Install non-apt packages 13 | function nonapt { 14 | eval `resize` 15 | NONAPT=$(whiptail \ 16 | --notags \ 17 | --title "non-apt packages" \ 18 | --menu "\nWhat non-apt packages would you like to install/update?" \ 19 | --ok-button "Install/Update" \ 20 | --cancel-button "Go Back" \ 21 | $LINES $COLUMNS $(( $LINES - 12 )) \ 22 | 'install_vim' '1. vim' \ 23 | 'rpackages' '2. R packages' \ 24 | 'install_pandoc' '3. pandoc' \ 25 | 'install_python' '4. python' \ 26 | 'install_docker' '5. docker' \ 27 | 'sourcecodepro' '6. Source Code Pro' \ 28 | 'travis' '7. travis-ci client' \ 29 | 'latexpkgs' '8. latex packages' \ 30 | 'gdal_install' '9. GDAL' \ 31 | 3>&1 1>&2 2>&3) 32 | 33 | exitstatus=$? 34 | if [ $exitstatus = 0 ]; then 35 | $NONAPT 36 | else 37 | main 38 | fi 39 | } 40 | -------------------------------------------------------------------------------- /functions/packages: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function non_inst_packages { 4 | PKGS_NI=() 5 | show_info_red "checking apt package installation status ... " 6 | while read F; do 7 | # cut comments from package names and remove all whitespace 8 | #PF=$(echo $F | cut -d "#" -f 1 | tr -d '[:space:]') 9 | PF=$(echo $F | cut -d " " -f 1) 10 | # but exclude packages commented-out with initial "#" 11 | if [[ $PF != "#"* ]] 12 | then 13 | PKGCHECK=$(dpkg-query -W --showformat='${Status}\n' $PF 2>&1|grep "install ok installed") 14 | if [ "" == "$PKGCHECK" ]; then 15 | PKGS_NI+=($PF) 16 | fi 17 | fi 18 | done < <(cat $PKGS $PKGST) 19 | } 20 | 21 | function gdal_install { 22 | GDAL_URL="http://download.osgeo.org/gdal/CURRENT/" 23 | wget -O temp.html $GDAL_URL 24 | GDAL_VERSION=`cat temp.html | grep -o -P '(?<=gdal-2).*(?=.tar.gz\")'` 25 | GDAL_FILE="gdal-2"$GDAL_VERSION".tar.gz" 26 | rm temp.html 27 | wget $GDAL_URL$GDAL_FILE 28 | tar zxf $GDAL_FILE 29 | cd "gdal-2"$GDAL_VERSION 30 | ./configure --with-sqlite3 --with-expat 31 | # Driver support can be checked by inspecting configure output, or by 32 | # $ gdal-config --formats 33 | make 34 | sudo make install 35 | cd .. 36 | rm -rf "gdal-2"$GDAL_VERSION $GDAL_FILE $GDAL_FILE 37 | sudo apt-get install libgdal-dev 38 | } 39 | 40 | function gdal { 41 | GNAME="GDAL" 42 | if hash gdalinfo 2>/dev/null; then 43 | show_info "GDAL installed" 44 | VERS=$(eval "gdalinfo --version" | head -n 2 | cut -d " " -f 2) 45 | MAJOR=$(echo $VERS | cut -d "." -f 1) 46 | MINOR=$(echo $VERS | cut -d "." -f 1) 47 | if [ $MAJOR -lt 2 ]; then 48 | if (whiptail --title $GNAME --yesno "$GNAME version < 2; upgrade?." 8 78) then 49 | gdal_install 50 | fi 51 | fi 52 | else 53 | if (whiptail --title $GNAME --yesno "$GNAME not installed; install?." 8 78) then 54 | gdal_install 55 | fi 56 | fi 57 | } 58 | 59 | function pgresql_switch { 60 | # Not used at at present 61 | # default bash streams are 0=std in, 1=std out, 2=error, so 2>&1 sends 62 | # errors to std out. 63 | PKGCHECK=$(psql 2>&1|grep "FATAL") # no postgres user 64 | if [ ! "" == "$PKGCHECK" ]; then 65 | show_info "Estalishing posgres user" 66 | sudo -u -i postgres # establish "postgres" as user 67 | fi 68 | } 69 | 70 | # Install packages listed in 'data/packages.list' 71 | # TODO: gdal and pgresql_check are only run if there are non-installed packages 72 | # - rearrange to run them every time. 73 | function packages { 74 | non_inst_packages 75 | gdal 76 | 77 | if [ ${#PKGS_NI[@]} -eq 0 ]; then 78 | whiptail --title "Packages Installed" --msgbox "All packages already installed." 8 78 79 | main 80 | elif (eval `resize` && whiptail \ 81 | --title "Packages" \ 82 | --yesno "Current list of packages to install: \n\n${PKGS_NI[*]\\} \n\nProceed with installation?" \ 83 | $LINES $COLUMNS $(( $LINES - 12 )) \ 84 | --scrolltext) then 85 | show_info 'Installing...' 86 | show_warning 'Requires root privileges' 87 | for i in ${PKGS_NI[@]}; do 88 | sudo apt-get install -y ${i} 89 | done 90 | 91 | sudo R CMD javareconf 92 | gdal 93 | 94 | # Done 95 | show_success 'Done.' 96 | # Check 97 | EXITSTATUS=$1 # Not used here. TODO: Fix this? 98 | if [[ $EXITSTATUS != 0 ]]; then 99 | # Already installed 100 | show_success 'Already installed.' 101 | whiptail --title "Finished" --msgbox "All packages installed." 8 78 102 | main 103 | else 104 | whiptail --title "Finished" --msgbox "All packages installed." 8 78 105 | main 106 | fi 107 | else 108 | main 109 | fi 110 | } 111 | -------------------------------------------------------------------------------- /functions/variables: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #DIR="$(dirname "$0")" 4 | KEYS="$DIR/data/keys.list" 5 | REPOS="$DIR/data/repos.list" 6 | DEPS="$DIR/data/dependencies.list" 7 | GSETTINGS="$DIR/data/gsettings.list" 8 | DSETTINGS="$DIR/data/dsettings.list" 9 | PKGS="$DIR/data/packages.list" 10 | PKGST="$DIR/data/packages-texlive.list" 11 | 12 | RPKGS="$DIR/data/rpackages.list" 13 | RPKGS_NI=() 14 | INST=$(sudo Rscript -e "rownames (installed.packages ())") 15 | while read F ; do 16 | # cut comments from package names and remove all whitespace 17 | #PF=$(echo $F | cut -d "#" -f 1 | tr -d '[:space:]') 18 | PF=$(echo $F | cut -d " " -f 1) 19 | if [[ $PF != "#"* ]] 20 | then 21 | if [[ ! ${INST[*]} =~ $PF ]] 22 | then 23 | RPKGS_NI+=($PF) 24 | fi 25 | fi 26 | done < $RPKGS 27 | CRAN="https://cran.r-project.org" 28 | RLIBLOC="/usr/local/lib/R/site-library/" 29 | 30 | PYPKGS=("numpy" "scipy" "matplotlib" "pandas" "sympy" "nose" "psutil") 31 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- Mode: sh; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 3 | # 4 | # Authors: 5 | # Sam Hewitt 6 | # Mark Padgham 7 | # 8 | # Description: 9 | # A post-installation bash script for Ubuntu. Any new scripts must be made 10 | # executable with >chmod u+x 11 | # 12 | # Legal Preamble: 13 | # 14 | # This script is free software; you can redistribute it and/or modify it under 15 | # the terms of the GNU General Public License as published by the Free Software 16 | # Foundation; version >=3. 17 | # 18 | # This script is distributed in the hope that it will be useful, but WITHOUT 19 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 20 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 21 | # details: 22 | # 23 | # tab width 24 | tabs 4 25 | clear 26 | # set -xv # for debugging 27 | 28 | #----- Fancy Messages -----# 29 | show_error(){ 30 | echo -e "\033[1;31m$@\033[m" 1>&2 31 | } 32 | show_info(){ 33 | echo -e "\033[1;32m$@\033[0m" 34 | } 35 | show_info_red(){ 36 | echo -e "\033[1;31m$@\033[0m" 37 | } 38 | show_warning(){ 39 | echo -e "\033[1;33m$@\033[0m" 40 | } 41 | show_question(){ 42 | echo -e "\033[1;34m$@\033[0m" 43 | } 44 | show_success(){ 45 | echo -e "\033[1;35m$@\033[0m" 46 | } 47 | show_header(){ 48 | echo -e "\033[1;36m$@\033[0m" 49 | } 50 | show_listitem(){ 51 | echo -e "\033[0;37m$@\033[0m" 52 | } 53 | 54 | #----- Import Functions -----# 55 | 56 | DIR="$(dirname "$0")" 57 | 58 | . $DIR/functions/variables 59 | 60 | . $DIR/functions/aptadd 61 | . $DIR/functions/check 62 | . $DIR/functions/cleanup 63 | . $DIR/functions/configure 64 | . $DIR/functions/doall 65 | . $DIR/functions/nonapt 66 | . $DIR/functions/packages 67 | 68 | # Main 69 | function main { 70 | eval `resize` 71 | MAIN=$(whiptail \ 72 | --notags \ 73 | --title "Ubuntu System Setup" \ 74 | --menu "\nWhat would you like to do?" \ 75 | --cancel-button "Quit" \ 76 | $LINES $COLUMNS $(( $LINES - 12 )) \ 77 | doall '1. Do all (non-interactive)' \ 78 | addapt '2. Add apt repositories' \ 79 | packages '3. Install apt packages' \ 80 | nonapt '4. Install non-apt packages' \ 81 | configure '5. Configure system' \ 82 | cleanup '6. Cleanup the system' \ 83 | 3>&1 1>&2 2>&3) 84 | 85 | exitstatus=$? 86 | if [ $exitstatus = 0 ]; then 87 | $MAIN 88 | else 89 | quit 90 | fi 91 | } 92 | 93 | # Quit 94 | function quit { 95 | exit 99 96 | } 97 | 98 | #RUN 99 | check_dependencies 100 | sudo -v 101 | while : 102 | do 103 | main 104 | done 105 | 106 | #END OF SCRIPT 107 | --------------------------------------------------------------------------------